This is the NAP caching module.

It provides the basic management functionality for the various backend databases which will be created based on the root topic of the NAP trees.

The actual handling of the various dbs is done with nav/backend.php, this class is responsible for the creation of backend instances and invalidation for NAP cache objects. (Which implies that it is fully aware of the data structures stored in the cache.)

All entries are indexed by their Midgard Object GUID. The entries in the NAP cache basically resemble the arrays within the NAP backend node/leaf cache

NAP caches can be shared over multiple sites, as all site specific data (like site prefixes) are evaluated during runtime.

Most of the cache update work is done in midcom_helper_nav_backend, so you should look there for details about the caching strategy.

see \global\midcom_helper_nav_backend
package midcom.services

 Methods

_on_initialize ()

Initialization event handler.

It will load the cache backends for the current MidCOM topic.

Initializes the backend configuration.

exists (string $key)

Checks for the existence of a key in the cache.

Parameters

$key

stringThe key to look up.

Returns

booleanIndicating existence

get_guid (string $guid, int $timeout)

Get a given array by GUID from the cache.

Parameters

$guid

stringThe key to look up.

$timeout

inthow long the data should live in the cache.

get_leaves (string $key)

Looks up a node in the cache and returns it.

Not existent keys are caught in this call as well, so you do not need to call exists first.

Parameters

$key

stringThe key to look up.

Returns

mixedThe cached value on success, false on failure.

get_node (string $key)

Looks up a node in the cache and returns it.

Not existent keys are caught in this call as well, so you do not need to call exists first.

Parameters

$key

stringThe key to look up.

Returns

mixedThe cached value on success, false on failure.

invalidate (string $guid)

Invalidates all cache objects related to the GUID specified.

Parameters

$guid

stringThe GUID to invalidate.

put_guid (string $guid, mixed $data, int $timeout)

Save a given array by GUID in the cache.

Parameters

$guid

stringThe key to store.

$data

mixedThe data to store.

$timeout

inthow long the data should live in the cache.

put_leaves (string $key, mixed $data, int $timeout)

Sets a given leave key in the cache

Parameters

$key

stringThe key to look up.

$data

mixedThe data to store.

$timeout

inthow long the data should live in the cache.

put_node (string $key, mixed $data, int $timeout)

Sets a given node key in the cache.

Parameters

$key

stringThe key to look up.

$data

mixedThe data to store.

$timeout

inthow long the data should live in the cache.

_load_from_guid ($guid)

Parameters

$guid

 Properties

 

string $_prefix

The cache key prefix.
 

Array $_backend

The configuration to use to start up the backend drivers.

Initialized during startup from the MidCOM configuration key cache_module_nap_backend.

 

\midcom_services_cache_backend $_cache

The cache backend instance to use.