Highlighted

ColdFusion Cache object keeps disappearing

Explorer ,
Feb 15, 2016

Copy link to clipboard

Copied

Hi,

I recently started using ColdFusion cache (cachePut/cacheGet) in CF10 to store some objects (struct/array).  However, the objects disappear from the cache within a day or so and I have to re-create them.  The cache objects are used regularly so there is no idle time that would cause them to time out.  For good measure, I have also set the "eternal" property of the cache to true. 

Does this have anything to do with the cache limit settings (for component, query caching, etc) in the admin?  I would think not, but I am perplexed as to why my cache keeps getting reset.  Anything I am not doing?

Thank you!

Views

695

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

ColdFusion Cache object keeps disappearing

Explorer ,
Feb 15, 2016

Copy link to clipboard

Copied

Hi,

I recently started using ColdFusion cache (cachePut/cacheGet) in CF10 to store some objects (struct/array).  However, the objects disappear from the cache within a day or so and I have to re-create them.  The cache objects are used regularly so there is no idle time that would cause them to time out.  For good measure, I have also set the "eternal" property of the cache to true. 

Does this have anything to do with the cache limit settings (for component, query caching, etc) in the admin?  I would think not, but I am perplexed as to why my cache keeps getting reset.  Anything I am not doing?

Thank you!

Views

696

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Feb 15, 2016 0
Engaged ,
Feb 15, 2016

Copy link to clipboard

Copied

In the ehcache.xml file you need to change the default cache time.   The file is in the  cfusion/lib directory.  At the end of the xml file in the defaultcache section change the timeToIdleSeconds and timeToLiveSeconds both to "0".  The current setting makes the cache timeout in a day.  Once you change the file restart CF and you should be good to go.  You may need to stop CF to edit the file in some occurances.

HTH,

--Dave

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Feb 15, 2016 0
Explorer ,
Feb 15, 2016

Copy link to clipboard

Copied

Thanks.  I will give it a try.  I was under the impression that the default timeout in cacheput (according to the documentation) is forever.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Feb 15, 2016 0
Engaged ,
Feb 15, 2016

Copy link to clipboard

Copied

Unfortunately the documentation is wrong.  The ehcache default is to not timeout but it was apparently changed.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Feb 15, 2016 0
minli98 LATEST
Explorer ,
Feb 22, 2016

Copy link to clipboard

Copied

Hi fergusondj,

I changed ehcache.xml and the cache has been running for a few days without timing out.  So that's great.  But one thing I still don't understand.  I keep refreshing the cacheGetMetaData( "myObject" ) and I noticed that the cache_misscount number keeps increasing.  According to the documentation, this is "Number of times the object was requested, but was not in the cache or was not up to date (was stale)".  I didn't think that the object is stale since I had set the time out to eternity.  And if the object isn't in the cache, may application would have thrown an error (which did not happen).  So I am not quite sure what this number mean.  Most importantly, does this suggest that caching is not 100% reliable in providing access to your stored variables?

Thanks!

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Feb 22, 2016 0