Question on adding cache connections in Application.cfc


#1

When adding the cache connections in the Application.cfc should I be able to view those connections or element counts inside of the server or web context admin areas? It would help me verify that objects are making it into the cache, or is their a different method I can call that lets me see the meta details of the cache connections.

Code looks like this.

<cfset this.cacheTemplate["DefaultCache"] = {} />
		<cfset this.cacheTemplate["DefaultCache"].class = 'lucee.runtime.cache.ram.RamCache' />
		<cfset this.cacheTemplate["DefaultCache"].storage = false />
		<cfset this.cacheTemplate["DefaultCache"].custom = {} />
		<cfset this.cacheTemplate["DefaultCache"].custom.timeToIdleSeconds="0" />
		<cfset this.cacheTemplate["DefaultCache"].custom.timeToLiveSeconds="0" />

		<cfset this.cache.connections["DefaultObjectCache"] = duplicate(this.cacheTemplate["DefaultCache"]) />
		<cfset this.cache.connections["DefaultObjectCache"].default = "object" />
		<cfset this.cache.object = "DefaultObjectCache" />

		<cfset this.cache.connections["DefaultQueryCache"] = duplicate(this.cacheTemplate["DefaultCache"]) />
		<cfset this.cache.connections["DefaultQueryCache"].default = "query" />
		<cfset this.cache.query = "DefaultQueryCache" />

#2

There are several useful cache functions that can allow you to get a view into the state of your cache. The best place to start for information would be at cfdocs:

https://cfdocs.org/cache-functions

In particular, cacheCount, cacheGetAllIds, cacheGetProperties and cacheGetMetaData might be of interest to you.

HTH

– Denny


#3

Thanks, I knew about the ones from adding objects to cacheput but not cachecount