NAME

Cache::CacheFactory::Expiry::Time - time-based expiry policy for Cache::CacheFactory.

DESCRIPTION

Cache::CacheFactory::Expiry::Time is a time-based expiry (pruning and validity) policy for Cache::CacheFactory.

It provides similar functionality and backwards-compatibility with the $expires_in and $default_expires_in properties of Cache::Cache.

INTERVAL SPECIFICATIONS

You can use any of the syntaxes provided by Cache::Cache to specify an interval for expiry times, for example:

$Cache::Cache::EXPIRES_NEVER
$Cache::Cache::EXPIRES_NOW
'4 seconds'
'1 m'
'now'
'never'

For a full list take a look at the set() section of the Cache::Cache documentation.

STARTUP OPTIONS

The following startup options may be supplied to Cache::CacheFactory::Expiry::Time, see the Cache::CacheFactory documentation for how to pass options to a policy.

default_prune_after => $interval

For a pruning policy this sets the default interval after which an item becomes eligible to be pruned.

default_valid_until => $interval

For a validity policy this sets the default time interval after which an item should be considered invalid.

default_expires_in => $interval

This option provides backwards-compatibility with Cache::Cache, it sets default_prune_after for pruning policies and default_valid_until for validity policies.

STORE OPTIONS

The following options may be set when storing a key, see the Cache::CacheFactory documentation for details on how to do this.

prune_after => $interval

For a pruning policy this sets the interval after which the item becomes eligible to be pruned. If not supplied then the value of default_prune_after in the startup options will be used.

valid_until => $interval

For a validity policy this sets the time interval after which the item should be considered invalid. If not supplied then the value of default_valid_until in the startup options will be used.

expires_in => $interval

This option provides backwards-compatibility with Cache::Cache, it behaves as prune_after for pruning policies and valid_until for validity policies.

METHODS

You should generally call these via the Cache::CacheFactory interface rather than directly.

$policy->set_default_expires_in( $default_expires_in );
$default_expires_in = $policy->get_default_expires_in();

Set or get the default_expires_in option.

SEE ALSO

Cache::CacheFactory, Cache::Cache, Cache::CacheFactory::Object, Cache::CacheFactory::Expiry::Base

AUTHORS

Original author: Sam Graham <libcache-cachefactory-perl BLAHBLAH illusori.co.uk>

Last author: $Author: illusori $

COPYRIGHT

Copyright 2008 Sam Graham.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.