Caching arbitrary objects (MGNLCACHE-55)

[MGNLCACHE-70] Change flush policy workspace registration Created: 13/Aug/14  Updated: 17/Jun/15  Resolved: 17/Jun/15

Status: Closed
Project: Cache Modules
Component/s: configuration
Affects Version/s: None
Fix Version/s: 5.4

Type: Sub-task Priority: Major
Reporter: Magnolia International Assignee: Roman Kovařík
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Relates
relates to MGNLCACHE-72 Update cache-related update tasks to ... Closed
dependency
is depended upon by MGNLADVCACHE-42 Adjust flush policies to changes in c... Closed
is depended upon by MGNLCACHE-83 Implement CacheKeyGenerator Closed
Template:
Release notes required:
Yes
Date of First Response:

 Description   

Change how flush policies are configured: assume we want to flush all repositories by default and only configure exceptions.



 Comments   
Comment by Roman Kovařík [ 21/Aug/14 ]

Migration task preserve compatibility with previous configuration by setting (newConfiguration/excludedWorkspaces) = (all workspaces \ oldConfiguration/repositories). The result of this update task was used as default configuration.

Comment by Magnolia International [ 22/Aug/14 ]

Re 70457fa3f0059d3fc3a26f17e6481e1b228c74969d:

  • Use an @Inject annotation
  • Mark your injected dependencies with final
  • No need to create an Object[] for vararg arguments (log statements)
  • Don't use stuff like ToStringBuilder.reflectionToString, especially in log statements. The cache key should have its own toString, and if it doesn't, too bad.
  • info.magnolia.module.cache.AbstractListeningFlushPolicy#start logs twice. Make a single log call, fix message format.

Re 881eb7bac6d657fcf855f71a4f398dd01d97ce41

  • Use the @javax.inject.Inject annotation, not Guice's !
  • Keep repositoryManager private (and final as noted above)
  • Cleaner for loops: for (String repo : getRepositories()) { (yours like a bastard mixture of while loops mixed with the "foreach" syntax of java 5)
  • If you keep backwards compatibility with the possibility to explicitly list the repos to flush (setRepositories), you should probably have a different method than getRepositories to produce the final list.
    • Separate configuration methods from "business" methods in the class; (I typically put the config methods below with a large "marker" comments (//--------- config methods below), but that's a matter of style preference, as long as they're separated)
  • Don't inject ModuleRegistry instead of CacheModule; one other, but not necessarily more elegant, solution is to inject a Provider<CacheModule>
  • typo in name of testAllRepositoriesExceptExlipcitlyDefined()

Ping me when that's fixed, i'll have another look, but looks good otherwise

Comment by Roman Kovařík [ 25/Aug/14 ]

Cleaner for loops: for (String repo : getRepositories()) { (yours like a bastard mixture of while loops mixed with the "foreach" syntax of java 5)

Is that not correct?
http://docs.oracle.com/javase/specs/jls/se7/html/jls-14.html#jls-14.14.2
All other pointed issues fixed.

Comment by Roman Kovařík [ 05/Dec/14 ]

Reopened - remove these workspaces from exclusion:

  • These are now wrongly not registered!:
    • config
    • forum
    • segments
    • personas
    • scripts
    • usergroups
    • userroles
    • users
  • These don't need to be excluded since are not activable:
    • messages
    • profiles
    • workflow
    • tasks
Comment by Roman Kovařík [ 28/Jan/15 ]

Reopened:

  • move new functionality to AbstractFlushListeningPolicy
  • both workspaces/exludedWorkspaces will be supported witch mutual exclusion. (since in ReferencePageFlushListeningPolicy) we need the original behaviour
  • repositories will be deprecated
Comment by Roman Kovařík [ 11/Feb/15 ]

Reopened:

  • Users needs to be excluded from cache since there are changes in this workspace when any user is logged in.
Comment by Roman Kovařík [ 25/May/15 ]

Reopened: Imaging should not by excluded from cache flush policy by default but by imaging module.

Comment by Roman Kovařík [ 15/Jun/15 ]

Reopened: mgnlVersion/mgnlSystem is now named magnolia-mgnlVersion, magnolia-mgnlSystem.

Comment by Evzen Fochr [ 17/Jun/15 ]

mgnlSystem still there

Generated at Sun Feb 11 23:51:54 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.