We were updating the refresh time in a non-thread-safe way, which
meant that we didn't always see the value correctly. We also did
not tell Ehcache that the value changed, which meant it was OK for
Ehcache to not update the disk cache with the new item, causing an
item to contain the wrong refresh time.
As part of this change we clean up the meaning of cache.name.maxAge
by never setting the idle time of an element, but instead setting
only the live time. The advantage is that we now have a much better
defined meaning of how maxAge is implemented: its literally how
long the item can remain in the cache before being recomputed.
We also clean up the meaning of cache.* default settings which
are shared onto all caches by simply removing them. They haven't
worked right in a while and after thinking about it I'm not sure
they even make any sense. The age for a web_session entry is going
to be quite different than the age for a diff entry, and the same
also goes for memoryLimit and diskLimit.
User's web session cookies are refreshed every hour, or at 1/2
cache.web_sessions.maxAge, whichever is smaller. By doing a
refresh every hour we reput the token into the cache and extend
its time-of-death forward to the current time plus maxAge. By not
refreshing more than an hour we reduce the amount of updates we
make to the cache, which may become an important issue if we ever
get a distributed cluster implementation of Gerrit working.
Bug: GERRIT-266
Change-Id: Ic4e63f7eeab73d4f8797d029b02a78ad440f4905
Signed-off-by: Shawn O. Pearce <sop@google.com>