Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: best way to keep a simple count?

by davidrw (Prior)
on Apr 11, 2005 at 15:55 UTC ( [id://446647]=note: print w/replies, xml ) Need Help??


in reply to best way to keep a simple count?

yet another way (not necessarily the best) would be Cache::FileCache (useful for many other things such as caching database query results). One downside (or upside) is you don't (readily--i think it throws it under /tmp/ somewhere) have the filename, so can't do "cat counter.txt" to check it.
use Cache::FileCache; my $cache = new Cache::FileCache( { namespace=>"my_program", auto_pu +rge_on_get=>1 } ); my $cacheKey = 'ct'; my $value = $cache->get( $cacheKey ) || 0; $value++; $cache->set( $cacheKey, $value, $EXPIRES_NEVER );

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://446647]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (6)
As of 2024-04-23 07:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found