Class

CacheManager

Package: IO\Data\cache Copyright: © 2005-2019 PHPBoost License: GNU/GPL-3.0 Author: Benoit SAUTEL ben.popeye@phpboost.com Version: PHPBoost 5.2 - last update: 2014 12 22 Since: PHPBoost 3.0 - 2009 09 16 Located at: io/data/cache/CacheManager.class.php

This class manages cache. It makes a two-level lazy loading:

  • A top-level cache which avoids loading a data if it has already been done since the beginning of the current page generation. This cache has a short life span: it's flushed as of the PHP interpreter reaches the end of the page generation.
  • A filesystem or shared RAM (via APC) cache to avoid querying the database every time to obtain the same value. This cache is less powerful than the previous but has an infinite life span. Indeed, it's valid until the value changes and the manager is asked to store it
Methods summary
public static CacheData
# load( string $classname, string $module_name, string $entry_name = '' )

Loads the data which is identified by the parameters

public static CacheData
# try_load( string $classname, string $module_name, string $entry_name )

Tries to load the data which is identified by the parameters

public static
# invalidate( string $module_name, string $entry_name = '' )

Invalidates an entry which is cached. If the corresponding data are loaded agin, they will be regenerated.

public static
# clear( )

Invalidates all the cached data

public static
# save( mixed $data, string $module_name, string $entry_name = '' )

Caches the data corresponding to the given identifier