Skip to content

Instantly share code, notes, and snippets.

@briedis
Last active August 24, 2021 17:23
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save briedis/d14c4fd416bab8b8b8b873a8d677a0a6 to your computer and use it in GitHub Desktop.
Save briedis/d14c4fd416bab8b8b8b873a8d677a0a6 to your computer and use it in GitHub Desktop.
Cache interface
<?php
interface CacheInterface
{
/**
* Store a mixed type value in cache for a certain amount of seconds.
* Supported values should be scalar types and arrays.
*
* @param string $key
* @param mixed $value
* @param int $duration Duration in seconds
* @return mixed
*/
public function set(string $key, $value, int $duration);
/**
* Retrieve stored item.
* Returns the same type as it was stored in.
* Returns null if entry has expired.
*
* @param string $key
* @return mixed|null
*/
public function get(string $key);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment