Try our conversational search powered by Generative AI!

Caching an object indefinitely against a page version

Vote:
 

The following article explain how to cache object based upon EPiServer page version dependancies. https://tedgustaf.com/blog/2010/cache-objects-in-episerver-with-page-dependencies/ 

The code 

var dependency = DataFactoryCache.CreateDependency(CurrentPage.PageLink);

CacheManager.RuntimeCacheInsert("myCacheKey",objectToCache,dependency);

Has a lot of obsolete code and I tried the final post in http://world.episerver.com/Forum/Developer-forum/EPiServer-CMS-6-R2/Thread-Container/2011/9/Null-in-Cache-objects-in-EPiServer-with-page-dependencies/ which also now has obsolete code. 

Does anyone have a working example using the latest version 9 of how to cache items agaist a page until that page changes?

Thanks,

Scott

#151356
Edited, Jul 18, 2016 13:55
Vote:
 

Check out this blog post to see if that gives you an idea how to solve it.

http://world.episerver.com/blogs/Daniel-Ovaska/Dates/2016/5/making-a-cache-dependency-on-pagetype-and-ancestor/

Otherwise let me know and I'll help you. I like caching :)

#151376
Edited, Jul 19, 2016 9:23
Vote:
 

Thanks for the feedback Daniel, I'll have a read over it but it all looks pretty self explanitory on a quick glance, there just didn't seem to be any solid information when looking and the old way was so easy to implement.

#151380
Edited, Jul 19, 2016 9:45
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.