[MGNLCACHE-55] Caching arbitrary objects Created: 14/Mar/14 Updated: 15/Dec/16 Resolved: 13/Aug/14 |
|
| Status: | Closed |
| Project: | Cache Modules |
| Component/s: | configuration |
| Affects Version/s: | None |
| Fix Version/s: | 5.4 |
| Type: | Improvement | Priority: | Major |
| Reporter: | Magnolia International | Assignee: | Roman Kovařík |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | m2 | ||
| Σ Remaining Estimate: | Not Specified | Remaining Estimate: | Not Specified |
| Σ Time Spent: | Not Specified | Time Spent: | Not Specified |
| Σ Original Estimate: | Not Specified | Original Estimate: | Not Specified |
| Issue Links: |
|
||||||||||||||||||||||||||||||||||||||||||||||||
| Sub-Tasks: |
|
||||||||||||||||||||||||||||||||||||||||||||||||
| Template: |
|
||||||||||||||||||||||||||||||||||||||||||||||||
| Acceptance criteria: |
Empty
|
||||||||||||||||||||||||||||||||||||||||||||||||
| Task DoD: |
[ ]*
Doc/release notes changes? Comment present?
[ ]*
Downstream builds green?
[ ]*
Solution information and context easily available?
[ ]*
Tests
[ ]*
FixVersion filled and not yet released
[ ] 
Architecture Decision Record (ADR)
|
||||||||||||||||||||||||||||||||||||||||||||||||
| Release notes required: |
Yes
|
||||||||||||||||||||||||||||||||||||||||||||||||
| Date of First Response: | |||||||||||||||||||||||||||||||||||||||||||||||||
| Description |
|
The current cache module is very biased towards caching pages (or request/responses in general). We've already abused it to cache uuid mappings, and it'd be beneficial to do this for other things too (personalization could use it, forum, ...) With our current API, one can get an arbitrary cache object by name, but that comes with FlushStrategy, etc, which are very likely irrelevant. Besides this unnecessary API leak, it is currently impossible to configurable such an arbitrary cache's underlying cache (i.e, for example, use different sizes and eviction mechanisms) - we can currently only configure the "defaultCacheFactory". http://wiki.magnolia-cms.com/display/DEV/Concept+-+Cache+arbitrary+objects |
| Comments |
| Comment by Magnolia International [ 14/Mar/14 ] |
|
|
| Comment by Magnolia International [ 19/May/14 ] |
|
Caching arbitrary object implies we'd want multiple configurations. Unfortunately, with the current ehcache version we use, we have to use a transformer for net.sf.ehcache.config.CacheConfiguration because of how memoryStoreEvictionPolicy's setter methods doesn't respect javabeans naming conventions. I'm hoping newer versions of EhCache have fixed this (but they have introduced other hurdles for us - see This goes hand in hand with renaming our current CacheConfiguration object to something like PageCacheConfiguration (this is the cache/flush policy config). |
| Comment by Magnolia International [ 23/May/14 ] |
|
We can solve one of the node2bean issues by subclassing net.sf.ehcache.config.CacheConfiguration (and thus being able to use our converter on a map of EhCacheConfigurations) |
| Comment by Magnolia International [ 04/Jun/14 ] |
|
Pushed to feature/cache-arbitrary-objects branch. Some TODOs left:
|
| Comment by Magnolia International [ 13/Aug/14 ] |
|
Pushed to feature/cache-arbitrary-objects-2 branch |
| Comment by Roman Kovařík [ 13/Aug/14 ] |
/Users/romankovarik/projects/master/cache/src/main/java/info/magnolia/module/cache/CacheConfiguration.java:36: Javadoc has empty description section. /Users/romankovarik/projects/master/cache/src/main/java/info/magnolia/module/cache/ehcache/EhCacheConfiguration.java:38:8: Unused import - net.sf.ehcache.config.PersistenceConfiguration. /Users/romankovarik/projects/master/cache/src/main/java/info/magnolia/module/cache/ehcache/EhCacheConfiguration.java:64: First sentence should end with a period. /Users/romankovarik/projects/master/cache/src/test/java/info/magnolia/module/cache/filter/BlockingCacheTest.java:76:8: Unused import - java.util.Map.
info.magnolia.objectfactory.NoSuchComponentException: No component configuration for type [info.magnolia.module.cache.ehcache.EhCacheConfigurationTransformer] found. Please add a configuration to your module descriptor.
java.lang.NullPointerException at info.magnolia.module.cache.filter.CacheFilter.onCacheModuleStart(CacheFilter.java:111) info.magnolia.module.cache.ehcache.EhCacheFactoryTest.canUseDifferentCacheConfigPerNamedCache(): I don't get the description |
| Comment by Roman Kovařík [ 13/Aug/14 ] |
|
For follow-up tickets: Create tickets for update of modules to reflect new cache settings: [INFO] [talledLocalContainer] 2014-08-13 11:00:09,057 ERROR info.magnolia.module.InstallContextImpl : > Could not create property contacts at /modules/cache/config/configurations/default/flushPolicy/policies/flushAll/repositories, please create it with value contacts. [INFO] [talledLocalContainer] 2014-08-13 11:00:10,648 ERROR info.magnolia.module.InstallContextImpl : > Could not create property dam at /modules/cache/config/configurations/default/flushPolicy/policies/flushAll/repositories, please create it with value dam. [INFO] [talledLocalContainer] 2014-08-13 11:00:19,119 ERROR info.magnolia.module.InstallContextImpl : > Could not install or update standard-templating-kit module. Task 'Browser cache policy' failed. (ItemNotFoundException: node /modules/cache/config/configurations/default/browserCachePolicy/policies has no child node with name default) [INFO] [talledLocalContainer] 2014-08-13 11:00:19,661 ERROR info.magnolia.module.InstallContextImpl : > Could not create property category at /modules/cache/config/configurations/default/flushPolicy/policies/flushAll/repositories, please create it with value category. [INFO] [talledLocalContainer] 2014-08-13 13:07:29,488 ERROR info.magnolia.module.InstallContextImpl : > Could not install or update personalization-integration module. Task 'Cache setup' failed. (PathNotFoundException: modules/cache/config/configurations) |
| Comment by Magnolia International [ 13/Aug/14 ] |
|
Sheesh, I don't know how the checkstyle stuff escaped me. Pushed fixes. (They'll need to be squashed when merging to master) Reported Where/how did you get the "NoSuchComponentException" and the NPE ? Thanks for the review ! |
| Comment by Roman Kovařík [ 14/Aug/14 ] |
I checked again upgrade of cache from 5.2.6 to 5.3 and no more NSCE/NPE so it was probably a miscofiguration from my side. Only this on startup: 2014-08-14 08:15:41,641 ERROR gnolia.jcr.node2bean.impl.Node2BeanTransformerImpl: Can't set property [persistence] to value [info.magnolia.module.cache.ehcache.EhCachePersistenceConfiguration@6186e175] in bean [info.magnolia.module.cache.ehcache.EhCacheConfiguration] for node /modules/cache/config/cacheFactory/caches/default due to java.lang.reflect.InvocationTargetException 2014-08-14 08:15:41,656 INFO info.magnolia.module.ModuleManagerImpl : Starting module cache 2014-08-14 08:15:41,656 WARN net.sf.ehcache.config.ConfigurationFactory : No configuration found. Configuring ehcache from ehcache-failsafe.xml found in the classpath: jar:file:/Users/romankovarik/bundles/5.3.2/ee/magnolia-enterprise-5.3.2/apache-tomcat-7.0.47/webapps/magnoliaAuthor/WEB-INF/lib/ehcache-2.8.3.jar!/ehcache-failsafe.xml |
| Comment by Roman Kovařík [ 18/Aug/14 ] |
net.sf.ehcache.config.InvalidConfigurationException: Cannot use both <persistence ...> and diskPersistent in a single cache configuration. So it's probably caused by http://jira.magnolia-cms.com/browse/MGNLCACHE-59?focusedCommentId=89765&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-89765 |
| Comment by Magnolia International [ 19/Aug/14 ] |
|
Pushed fixes addressing your points; second round of review ? |
| Comment by Roman Kovařík [ 20/Aug/14 ] |
|
Could we solve also the latest subtask |