Cached References in Railo

Be careful when working with the cache in Railo. I recently discovered that if you provide the cache with a reference it will cache the reference (the pointer to the value in memory) and not the value itself. At best you will run into some unexpected behavior. At worst if you are operating in a clustered environment with with a centralized caching server, only the app server that created the cache entry will have the value in memory. This will probably create an error on the servers that do not but the error will not flush the cache entry so the error will persist. Instead you will need to serialize the object and store it as a primitive value in the cache, de-serializing on retrieval.

Others are probably aware of this but it threw me for a loop and I would able to find anything about it on the web.