Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions phalcon/Storage/Adapter/Redis.zep
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,33 @@ class Redis extends AbstractAdapter
parent::__construct(factory, options);
}

/**
* Returns the time to live left for a given key in seconds.
* If the key has no ttl, -1 will be returned, and -2 if the key doesn't exist.
*
* @param string $key
*
* @return int
* @throws StorageException
*/
public function ttl(string! key) -> int
{
return this->getAdapter()->ttl(key);
}

/**
* Returns the time to live left for a given key in milliseconds
*
* @param string $key
*
* @return int
* @throws StorageException
*/
public function pttl(string! key) -> int
{
return this->getAdapter()->pttl(key);
}

/**
* Flushes/clears the cache
*
Expand Down