AloFramework Cache 1.0 API
  • Namespace
  • Class
  • Tree
  • Deprecated
  • Todo

Namespaces

  • AloFramework
    • Cache
      • Clients
      • Config
  • PHP

Classes

  • RedisClient

Class RedisClient

A Redis-based cache client

Redis
Extended by AloFramework\Cache\Clients\RedisClient implements AloFramework\Cache\ClientInterface, AloFramework\Config\Configurable uses AloFramework\Config\ConfigurableTrait (not available)
Namespace: AloFramework\Cache\Clients
Author: Art a.molcanovas@gmail.com
Located at Clients/RedisClient.php

Methods summary

public
# __construct( AloFramework\Cache\Config\RedisConfig $config = null, Psr\Log\LoggerInterface $logger = null )

Contructor

Contructor

Parameters

$config
Config object
$logger

User-supplied logging object. AloFramework\Log will be used if one isn't supplied

Throws

AloFramework\Cache\CacheException
If the Redis PHP extension isn't enabled

Author

Art a.molcanovas@gmail.com

Overrides

Redis::__construct
public boolean
# connect( string $ip = null, integer $port = null )

Connect to the cache server

Connect to the cache server

Parameters

$ip
Server IP
$port
Server port

Returns

boolean
Whether the connection succeeded

Author

Art a.molcanovas@gmail.com

Overrides

Redis::connect

Implementation of

AloFramework\Cache\ClientInterface::connect()
public integer
# count( )

Count elements of an object

Count elements of an object

Returns

integer

Link

http://php.net/manual/en/countable.count.php

Implementation of

Countable::count()
public AloFramework\Cache\Clients\RedisClient
# delete( string|array $key )

Deletes a cached item

Deletes a cached item

Parameters

$key
Item key or array of keys

Returns

AloFramework\Cache\Clients\RedisClient

Author

Art a.molcanovas@gmail.com

Overrides

Redis::delete

Implementation of

AloFramework\Cache\ClientInterface::delete()
public mixed
# getKey( string $key )

Returns a cached item

Returns a cached item

Parameters

$key
Item key

Returns

mixed
The item or null if it's not found

Author

Art a.molcanovas@gmail.com

Implementation of

AloFramework\Cache\ClientInterface::getKey()
public mixed|bool:
# get( string $key )

Get the value related to the specified key

Get the value related to the specified key

Parameters

$key

Returns

mixed|bool:

If key didn't exist, FALSE is returned. Otherwise, the value related to this key is returned.

Author

Art a.molcanovas@gmail.com

Link

http://redis.io/commands/get

Overrides

Redis::get
public array
# getMultiple( array $keys )

Get the values of all the specified keys. If one or more keys dont exist, the array will contain FALSE at the position of the key.

Get the values of all the specified keys. If one or more keys dont exist, the array will contain FALSE at the position of the key.

Parameters

$keys
Array containing the list of the keys

Returns

array
Array containing the values related to keys in argument

Author

Art a.molcanovas@gmail.com

Overrides

Redis::getMultiple
public boolean
# setKey( string $key, mixed $value, integer|DateTimeInterface $timeout = null )

Sets a cached item

Sets a cached item

Parameters

$key
Item key
$value
Item value
$timeout

Expiration time in seconds, or a DateTimeInterface object for when it's supposed to expire

Returns

boolean

Author

Art a.molcanovas@gmail.com

Since

1.0.2 Uses DateTimeInterface instead of DateTime

Implementation of

AloFramework\Cache\ClientInterface::setKey()
public bool:
# setex( string $key, integer $ttl, mixed $value )

Set the string value in argument as value of the key, with a time to live.

Set the string value in argument as value of the key, with a time to live.

Parameters

$key
Key to set
$ttl
Lifetime
$value
Value to set. Non-scalar values will be json-encoded

Returns

bool:
TRUE if the command is successful.

Author

Art a.molcanovas@gmail.com

Link

http://redis.io/commands/setex

Overrides

Redis::setex
public bool:
# setnx( string $key, string $value )

Set the string value in argument as value of the key if the key doesn't already exist in the database.

Set the string value in argument as value of the key if the key doesn't already exist in the database.

Parameters

$key
The key
$value
The value. If the value isn't scalar it will be json_encoded

Returns

bool:
TRUE in case of success, FALSE in case of failure.

Link

http://redis.io/commands/setnx

Overrides

Redis::setnx
public bool:
# set( string $key, string $value, integer $ttl = 0 )

Set the string value in argument as value of the key.

Set the string value in argument as value of the key.

Parameters

$key
Key to set
$value
Value to set. If the value isn't scalar it will be json_encoded
$ttl
[optional] Calling setex() is preferred if you want a timeout.

Returns

bool:
TRUE if the command is successful.

Author

Art a.molcanovas@gmail.com

Link

http://redis.io/commands/set

Overrides

Redis::set
public array
# getAll( )

Returns all the cached items as an associative array

Returns all the cached items as an associative array

Returns

array

Author

Art a.molcanovas@gmail.com

Implementation of

AloFramework\Cache\ClientInterface::getAll()
public boolean
# purge( )

Purges all cached items

Purges all cached items

Returns

boolean

Author

Art a.molcanovas@gmail.com

Implementation of

AloFramework\Cache\ClientInterface::purge()
public Traversable
# getIterator( )

Retrieve an external iterator

Retrieve an external iterator

Returns

Traversable

An instance of an object implementing Iterator or Traversable

Author

Art a.molcanovas@gmail.com

Link

http://php.net/manual/en/iteratoraggregate.getiterator.php

Implementation of

IteratorAggregate::getIterator()
public boolean
# offsetExists( mixed $offset )

Whether a offset exists

Whether a offset exists

Parameters

$offset
The key

Returns

boolean

Author

Art a.molcanovas@gmail.com

Link

http://php.net/manual/en/arrayaccess.offsetexists.php

Implementation of

ArrayAccess::offsetExists()
public mixed
# offsetGet( mixed $offset )

Offset to retrieve

Offset to retrieve

Parameters

$offset
The key

Returns

mixed

Author

Art a.molcanovas@gmail.com

Link

http://php.net/manual/en/arrayaccess.offsetget.php

Implementation of

ArrayAccess::offsetGet()
public boolean
# exists( string $key )

Check if the key exists

Check if the key exists

Parameters

$key
The key

Returns

boolean

Author

Art a.molcanovas@gmail.com

Overrides

Redis::exists

Implementation of

AloFramework\Cache\ClientInterface::exists()
public
# offsetSet( string $offset, mixed $value )

Offset to set

Offset to set

Parameters

$offset
The key
$value
Value to set

Author

Art a.molcanovas@gmail.com

Link

http://php.net/manual/en/arrayaccess.offsetset.php

Implementation of

ArrayAccess::offsetSet()
public
# offsetUnset( mixed $offset )

Offset to unset

Offset to unset

Parameters

$offset
The key

Author

Art a.molcanovas@gmail.com

Link

http://php.net/manual/en/arrayaccess.offsetunset.php

Implementation of

ArrayAccess::offsetUnset()
public integer
# getRemainingLifetime( string $key )

Returns how many seconds this key has left before expiring

Returns how many seconds this key has left before expiring

Parameters

$key
The key

Returns

integer
The remaining lifetime in seconds. If the key doesn't exist 0 is returned.

Author

Art a.molcanovas@gmail.com

Implementation of

AloFramework\Cache\ClientInterface::getRemainingLifetime()

Methods inherited from Redis

__destruct(), _prefix(), _serialize(), _unserialize(), append(), auth(), bgSave(), bgrewriteaof(), bitcount(), bitop(), bitpos(), blPop(), brPop(), brpoplpush(), clearLastError(), client(), close(), config(), dbSize(), debug(), decr(), decrBy(), del(), discard(), dump(), echo(), eval(), evalsha(), evaluate(), evaluateSha(), exec(), expire(), expireAt(), flushAll(), flushDB(), getAuth(), getBit(), getDBNum(), getHost(), getKeys(), getLastError(), getMode(), getOption(), getPersistentID(), getPort(), getRange(), getReadTimeout(), getSet(), getTimeout(), hDel(), hExists(), hGet(), hGetAll(), hIncrBy(), hIncrByFloat(), hKeys(), hLen(), hMget(), hMset(), hSet(), hSetNx(), hVals(), hscan(), incr(), incrBy(), incrByFloat(), info(), isConnected(), keys(), lGet(), lGetRange(), lInsert(), lLen(), lPop(), lPush(), lPushx(), lRemove(), lSet(), lSize(), lastSave(), lindex(), listTrim(), lrange(), lrem(), ltrim(), mget(), migrate(), move(), mset(), msetnx(), multi(), object(), open(), pconnect(), persist(), pexpire(), pexpireAt(), pfadd(), pfcount(), pfmerge(), ping(), pipeline(), popen(), psetex(), psubscribe(), pttl(), publish(), pubsub(), punsubscribe(), rPop(), rPush(), rPushx(), randomKey(), rawCommand(), rename(), renameKey(), renameNx(), resetStat(), restore(), rpoplpush(), sAdd(), sContains(), sDiff(), sDiffStore(), sGetMembers(), sInter(), sInterStore(), sMembers(), sMove(), sPop(), sRandMember(), sRemove(), sSize(), sUnion(), sUnionStore(), save(), scan(), scard(), script(), select(), sendEcho(), setBit(), setOption(), setRange(), setTimeout(), sismember(), slaveof(), slowlog(), sort(), sortAsc(), sortAscAlpha(), sortDesc(), sortDescAlpha(), srem(), sscan(), strlen(), subscribe(), substr(), time(), ttl(), type(), unsubscribe(), unwatch(), wait(), watch(), zAdd(), zCard(), zCount(), zDelete(), zDeleteRangeByRank(), zDeleteRangeByScore(), zIncrBy(), zInter(), zRange(), zRangeByLex(), zRangeByScore(), zRank(), zRem(), zRemRangeByRank(), zRemRangeByScore(), zRemove(), zRemoveRangeByScore(), zRevRangeByScore(), zRevRank(), zReverseRange(), zScore(), zSize(), zUnion(), zinterstore(), zrevrange(), zscan(), zunionstore()

Constants summary

Constants inherited from Redis

AFTER, ATOMIC, BEFORE, MULTI, OPT_PREFIX, OPT_READ_TIMEOUT, OPT_SCAN, OPT_SERIALIZER, PIPELINE, REDIS_HASH, REDIS_LIST, REDIS_NOT_FOUND, REDIS_SET, REDIS_STRING, REDIS_ZSET, SCAN_NORETRY, SCAN_RETRY, SERIALIZER_IGBINARY, SERIALIZER_NONE, SERIALIZER_PHP

Properties summary

protected Psr\Log\LoggerInterface $log

Logger

Logger

#
AloFramework Cache 1.0 API API documentation generated by ApiGen