andreacfm/Railo-MongoDB-Cache-Extension — pull request #2 by mtbkapp (2012-11-14 20:02:53+00:00)
Title: Add CacheWithTeardown, remove singleton mongo connection and cleanup thread

Changed singleton MongoDB connection to a connection factory. The new connection factory uses the web config id and the cache name as an identifier for unique MongoDB connections and given that identifier will return the same connection. The configuration struct each connection is configured with is also stored in the connection factory so if a connection is requested with the same identifier but different arguments then the old connection can be closed and a new connection can be made. The singleton method previously implemented made it so only a single connection to MongoDB could be made per JVM. Also, removed the clean task in favor of a threshold mechanism. A separate thread can never be stopped because of the way Railo interacts with the cache driver. The threshold mechanism clears the cache of invalid entires after 1000 reads.

The changes made here depend on commit f9f03d426c6d34a1877952076425f78b185a700b in pull request https://github.com/getrailo/railo/pull/77. These changes to the driver depend on the interface CacheWithTeardown.