0

Is it possible to obtain a fragment cache entry creation date?

Details: I use fragment caching for attachment link rendering in Wiki pages in ChilliProject. Cache key is formed from attachment file name. If the attachment was reloaded, I need update a cache. So I want compare attachment file modification date and cache entry's creation date. How can I do it?

Beforehand thankful.

ILYA
  • 495
  • 6
  • 18

1 Answers1

0
Time.at(Rails.cache.send(:read_entry,'cache/entry/key',{})).created_at)

read_entry method returns ActiveSupport::Cache::Entry object

Ashish Chopra
  • 1,413
  • 9
  • 23
  • I tried it with a key used for write_fragment, but it returns nil. According to [this](http://stackoverflow.com/a/757002/820644) answer keys are different. And Rails.cache.class returns MemoryStore, not FileStore – ILYA Mar 20 '14 at 14:54