PHP Class Jyxo\Spl\ObjectCache

Example: $key = 'User_Friends/' . $user->username(); return \Jyxo\Spl\ObjectCache::get($key) ?: \Jyxo\Spl\ObjectCache::set($key, new \User\Friends($this->context, $user));
Author: Jakub Tománek
Inheritance: implements IteratorAggregate
Show file Open project: jyxo/php Class Usage Examples

Public Methods

Method Description
__get ( string $key ) : object Returns an object from an own storage.
__isset ( string $key ) : boolean Returns if there's an object with key $key in the storage.
__set ( string $key, object $value ) Saves an object into an own storage.
__unset ( mixed $key ) Deletes an object with key $key from the storage.
clear ( ) : self Clear the whole storage.
get ( string $key ) : object Returns an object from the default storage.
getInstance ( ) : self Returns default storage for static access.
getIterator ( ) : ArrayIterator Returns an iterator.
set ( string $key, object $value ) : object Saves an object into the default storage.

Method Details

__get() public method

Returns an object from an own storage.
public __get ( string $key ) : object
$key string Object key
return object

__isset() public method

Returns if there's an object with key $key in the storage.
public __isset ( string $key ) : boolean
$key string Object key
return boolean

__set() public method

Saves an object into an own storage.
public __set ( string $key, object $value )
$key string Object key
$value object Object

__unset() public method

Deletes an object with key $key from the storage.
public __unset ( mixed $key )
$key mixed Object key

clear() public method

Clear the whole storage.
public clear ( ) : self
return self

get() public static method

Returns an object from the default storage.
public static get ( string $key ) : object
$key string Object key
return object

getInstance() public static method

Returns default storage for static access.
public static getInstance ( ) : self
return self

getIterator() public method

Returns an iterator.

set() public static method

Saves an object into the default storage.
public static set ( string $key, object $value ) : object
$key string Object key
$value object Object
return object saved object