Last active
August 28, 2024 18:38
-
-
Save briedis/d14c4fd416bab8b8b8b873a8d677a0a6 to your computer and use it in GitHub Desktop.
Cache interface
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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