diff options
author | Valentin Popov <info@valentineus.link> | 2018-02-18 19:01:55 +0300 |
---|---|---|
committer | Valentin Popov <info@valentineus.link> | 2018-02-18 19:01:55 +0300 |
commit | 53c49b69de8e7489f3913177cfce850168870bf2 (patch) | |
tree | 6cb6ba050225c44f1a8779f839f575510ad18b33 | |
parent | f392fd42d952a0abb06f01acfaf259381facb819 (diff) | |
download | local_webhooks-53c49b69de8e7489f3913177cfce850168870bf2.tar.xz local_webhooks-53c49b69de8e7489f3913177cfce850168870bf2.zip |
Added functions for working with the cache
-rw-r--r-- | lib.php | 34 |
1 files changed, 34 insertions, 0 deletions
@@ -45,6 +45,40 @@ function local_webhooks_change_status($serviceid) { } /** + * Get data from the cache by key. + * + * @param string $eventname + * @return array + */ +function local_webhooks_cache_get($eventname) { + $cache = cache::make("local_webhooks", "webhooks_services"); + return $cache->get($eventname); +} + +/** + * Update the data in the cache by key. + * + * @param string $eventname + * @param array $recordlist + * @return boolean + */ +function local_webhooks_cache_set($eventname, $recordlist = array()) { + $cache = cache::make("local_webhooks", "webhooks_services"); + return $cache->set($eventname, $recordlist); +} + +/** + * Delete the data in the cache by key. + * + * @param string $eventname + * @return boolean + */ +function local_webhooks_cache_delete($eventname) { + $cache = cache::make("local_webhooks", "webhooks_services"); + return $cache->delete($eventname); +} + +/** * Get the record from the database. * * @param number $serviceid |