Use a read/write lock in CacheEntry

The read lock should be acquired when getting or setting the value, but in getValue() and setValue(V val) there was no lock being acquired.

This lack of locking can result in race conditions. I discovered this issue by clearing the GroovyPagesTemplateEngine cache in an infinite loop, which caused page metaclasses to not be removed, resulting in a memory leak.
Merge pull request #543 from candrews/patch-16

Acquire the lock when getting or setting the value