PHP Класс Ouzo\Utilities\Cache

Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
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.

Описание методов

clear() публичный статический метод

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

contains() публичный статический метод

Checks if cache contains an object for the given key.
public static contains ( $key ) : boolean
$key
Результат boolean

get() публичный статический метод

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
Результат mixed | null

memoize() публичный статический метод

Example: $countries = Cache::memoize(function() {{ expensive computation that returns a list of countries return Country:all(); })
public static memoize ( $function ) : mixed | null
$function
Результат mixed | null

put() публичный статический метод

public static put ( $key, $object ) : mixed
$key
$object
Результат mixed

size() публичный статический метод

Returns number of stored objects.
public static size ( ) : integer
Результат integer