PHP Class Ouzo\Utilities\Cache

Afficher le fichier Open project: letsdrink/ouzo Class Usage Examples

Méthodes publiques

Méthode Description
clear ( ) Clears all items stored in cache.
contains ( $key ) : boolean Checks if cache contains an object for the given key.
get ( $key, null $function = null ) : mixed | null Returns object from cache.
memoize ( $function ) : mixed | null Caches the given closure using filename:line as a key.
put ( $key, $object ) : mixed
size ( ) : integer Returns number of stored objects.

Method Details

clear() public static méthode

Clears all items stored in cache.
public static clear ( )

contains() public static méthode

Checks if cache contains an object for the given key.
public static contains ( $key ) : boolean
$key
Résultat boolean

get() public static méthode

If there's no object for the given key and $functions is passed, $function result will be stored in cache under the given key. Example: $countries = Cache::get("countries", function() {{ expensive computation that returns a list of countries return Country:all(); })
public static get ( $key, null $function = null ) : mixed | null
$key
$function null
Résultat mixed | null

memoize() public static méthode

Example: $countries = Cache::memoize(function() {{ expensive computation that returns a list of countries return Country:all(); })
public static memoize ( $function ) : mixed | null
$function
Résultat mixed | null

put() public static méthode

public static put ( $key, $object ) : mixed
$key
$object
Résultat mixed

size() public static méthode

Returns number of stored objects.
public static size ( ) : integer
Résultat integer