expire application variable

2014-08-07 Thread John M Bliss

I have a case where I need to have an application variable expire after a
known amount of time. Do you have a favorite method for doing this? I was
thinking of something like:

application.thevar = structnew();
application.thevar.createtick = gettickcount();
application.thevar.thevalue = foo;

...and then, on use, checking gettickcount()
- application.thevar.createtick.

Good?

Better way?

-- 
John Bliss - http://www.linkedin.com/in/jbliss


~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:359089
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: expire application variable

2014-08-07 Thread Carl Von Stetten

Are you on ColdFusion 9+?  Why not use the built-in cache functionality 
(cachePut(), cacheGet(), etc.)?  If you are on ColdFusion 10+, you can 
even put related objects into a cache region and manually flush that 
region using CacheRemoveAll( region ) .
-Carl V.

On 8/7/2014 1:06 PM, John M Bliss wrote:
 I have a case where I need to have an application variable expire after a
 known amount of time. Do you have a favorite method for doing this? I was
 thinking of something like:

 application.thevar = structnew();
 application.thevar.createtick = gettickcount();
 application.thevar.thevalue = foo;

 ...and then, on use, checking gettickcount()
 - application.thevar.createtick.

 Good?

 Better way?



~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:359090
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: expire application variable

2014-08-07 Thread John M Bliss

Sweet. Thanks!
On Aug 7, 2014 5:51 PM, Carl Von Stetten vonner.li...@vonner.net wrote:


 Are you on ColdFusion 9+?  Why not use the built-in cache functionality
 (cachePut(), cacheGet(), etc.)?  If you are on ColdFusion 10+, you can
 even put related objects into a cache region and manually flush that
 region using CacheRemoveAll( region ) .
 -Carl V.

 On 8/7/2014 1:06 PM, John M Bliss wrote:
  I have a case where I need to have an application variable expire after a
  known amount of time. Do you have a favorite method for doing this? I was
  thinking of something like:
 
  application.thevar = structnew();
  application.thevar.createtick = gettickcount();
  application.thevar.thevalue = foo;
 
  ...and then, on use, checking gettickcount()
  - application.thevar.createtick.
 
  Good?
 
  Better way?
 


 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:359091
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm