Problem/Motivation
Entities are cached with an expire value of CACHE_PERMANENT, however I have a case where I want them to expire after a certain amount of time. The reason in my case is that I use the Pathologic input filter to convert system-path links to aliased-path links (ie, convert /node/123 to /my-alias). Unfortunately when a node's alias changes, links to it inside other nodes become broken, because entitycache is still serving the last rendering of the input filter.
Proposed resolution
Ideally I could react to node aliases being changed, and search the database for any content with a link to that node. However this is for a very large site, with content being edited constantly, so I think that query would be too expensive. So instead I would prefer a simpler approach of letting the cached entities expire after 24 hours. So my proposal is to add an alter hook in entitycache to allow this.
Remaining tasks
Review attached patch
User interface changes
None
API changes
New alter hook
Data model changes
None
Comment | File | Size | Author |
---|---|---|---|
#2 | entitycache-expire_alteration-2612600-2.patch | 1.46 KB | brockfanning |
|
Comments
Comment #2
brockfanning CreditAttribution: brockfanning commentedComment #3
bibo CreditAttribution: bibo commentedThis seems to be almost exactly what I need, will test the patch soon!
One suggestion already before testing: wouldn't it be better to pass $item to the alter function, so we could add more complex logic, not just based on entity/nodetype?
Also, why not add the possibility to skip the cache set entirely via the alter?
Comment #4
bibo CreditAttribution: bibo commented..actually, maybe I wont, since this stuff in latest dev seems to allow me to alter the stuff. Though, I still would want control over expiration times as fallback.
Hmm.