PHP Class Phalcon\Translate\Adapter\Redis

Inheritance: extends Phalcon\Translate\Adapter\Base, implements Phalcon\Translate\AdapterInterface
Show file Open project: phalcon/incubator Class Usage Examples

Protected Properties

Property Type Description
$cache array Local cache.
$language string Language.
$levels integer How much containers to use in Redis for translations. Calculated with 16^$levels.
$redis Redis Redis object.

Public Methods

Method Description
__construct ( array $options ) Class constructor.
add ( string $translateKey, string $message ) : boolean Adds a translation for given key (No existence check!)
delete ( string $translateKey ) : boolean Deletes a translation for given key (No existence check!)
exists ( string $translateKey ) : boolean
offsetExists ( string $translateKey ) : string
offsetGet ( string $translateKey ) : string
offsetSet ( string $translateKey, string $message ) : string
offsetUnset ( string $translateKey ) : string
query ( string $translateKey, array $placeholders = null ) : string
set ( string $translateKey, string $message ) : boolean Sets (insert or updates) a translation for given key
update ( string $translateKey, string $message ) : boolean Update a translation for given key (No existence check!)

Protected Methods

Method Description
getLongKey ( string $index ) : string Returns long key for index.
getShortKey ( string $index ) : string Returns short key for index.
loadValueByKey ( string $key ) Loads key from Redis to local cache.

Method Details

__construct() public method

Class constructor.
public __construct ( array $options )
$options array

add() public method

Adds a translation for given key (No existence check!)
public add ( string $translateKey, string $message ) : boolean
$translateKey string
$message string
return boolean

delete() public method

Deletes a translation for given key (No existence check!)
public delete ( string $translateKey ) : boolean
$translateKey string
return boolean

exists() public method

public exists ( string $translateKey ) : boolean
$translateKey string
return boolean

getLongKey() protected method

Returns long key for index.
protected getLongKey ( string $index ) : string
$index string
return string

getShortKey() protected method

Returns short key for index.
protected getShortKey ( string $index ) : string
$index string
return string

loadValueByKey() protected method

Loads key from Redis to local cache.
protected loadValueByKey ( string $key )
$key string

offsetExists() public method

public offsetExists ( string $translateKey ) : string
$translateKey string
return string

offsetGet() public method

public offsetGet ( string $translateKey ) : string
$translateKey string
return string

offsetSet() public method

public offsetSet ( string $translateKey, string $message ) : string
$translateKey string
$message string
return string

offsetUnset() public method

public offsetUnset ( string $translateKey ) : string
$translateKey string
return string

query() public method

public query ( string $translateKey, array $placeholders = null ) : string
$translateKey string
$placeholders array
return string

set() public method

Sets (insert or updates) a translation for given key
public set ( string $translateKey, string $message ) : boolean
$translateKey string
$message string
return boolean

update() public method

Update a translation for given key (No existence check!)
public update ( string $translateKey, string $message ) : boolean
$translateKey string
$message string
return boolean

Property Details

$cache protected property

Local cache.
protected array $cache
return array

$language protected property

Language.
protected string $language
return string

$levels protected property

How much containers to use in Redis for translations. Calculated with 16^$levels.
protected int $levels
return integer

$redis protected property

Redis object.
protected Redis,Phalcon\Translate\Adapter $redis
return Redis