Easy Java Caching

From Zanecorpwiki

Jump to: navigation, search

It's easy to build special purpose caches with the codeWeakReference/code class. The WR instance wraps another instance creating a 'weak reference'. An instance will be garbage collected when there are no strong references to it. By creating a weak reference, you can use the cached value when available, but you don't bloat the memory with nice-to-haves and maybe-usefuls. In most cases you'll want to abstract out the question of whether or not the item is currently caches.

Personal tools