use Cache::FileCache; my $cache = new Cache::FileCache( { namespace=>"TimeLocks" } ); my $key = "something_bad"; if( ! $cache->get($key) ){ # do stuff $cache->set( $key, time, "10 minutes" ); # note the value could just be '1', or any other true value. }