Pootle::Cache

Persist API results somewhere to prevent excessive spamming of the Pootle-Client. These changes might persist over the current process exiting.

Transient cache

Pootle::Cache has a transient portion, values stored here disappear after the program exits. You can access this cache with methods tGet, tPut, t*, ... If you want to refresh the results of methods, which have the "@CACHED Transiently" -tag you must flush the transient cache using: $cache->tFlush(); or restart the program.

Persistent cache

Pootle::Cache has a persistent portion, values stored here will be flushed to the on-disk cache file, if the program exits normally. You can access this cache with methods pGet, pPut, p*, ... If you want to refresh the results of methods, which have the "@CACHED Persistently" -tag you must flush the persistent cache using: $cache->pFlush();

new

my $c = new Pootle::Cache({
  cacheFile => 'pootle-client.cache', #Where the persistent cache should be saved?
});

loadCache

Loads cache from disk, if cache is not present, tests for file permissions to persist one.

_evalCacheContents @STATIC

Turn the raw cache contents into a perl data structure

@PARAM1 String, raw cache contents
@RETURNS HASHRef

tSet

Store a value to the transient in-memory store. This will never be flushed to disk.

pSet

Store a value to the persistent in-memory store

Flushes the persistent cache from disk, forcing the Pootle::Client to fetch new values from the Pootle Server's API on subsequent API requests.

@RETURNS whatever unlink returns, 0 on success, 1 on failure atleast. unlink docs don't say.

toString

my $pc = Pootle::Cache->new();
print "Cuddling with Cache ".$pc." tonight\n";

Serialize this Cache as a simple one-liner keypoint description of it's internal state

@RETURNS String

Accessors

cacheFile
pCache
tCache

2 POD Errors

The following errors were encountered while parsing the POD:

Around line 158:

Unknown directive: =head

Around line 204:

=over without closing =back