Skip to content

Instantly share code, notes, and snippets.

@arturssmirnovs
Created March 5, 2021 13:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arturssmirnovs/f88beff6a6acb91b45a2a148feff3e9a to your computer and use it in GitHub Desktop.
Save arturssmirnovs/f88beff6a6acb91b45a2a148feff3e9a to your computer and use it in GitHub Desktop.
<?php
interface CacheInterface {
/**
* Get cached entry if exists
*
* @param string $key
* @return mixed|null
*/
public function get(string $key);
/**
* Set cached entry by specifying key and value and duration in ms.
*
* @param string $key
* @param $value
* @param int $duration
* @return mixed
*/
public function set(string $key, $value, int $duration);
/**
* Delete cached entry
*
* @param string $key
* @return boolean
*/
public function delete(string $key);
/**
* Check if cached entry exists
*
* @param string $key
* @return boolean
*/
public function exists(string $key);
/**
* Clear all cached entries
*
* @return mixed
*/
public function clear();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment