diff options
author | Valentin Popov <info@valentineus.link> | 2018-02-18 20:28:46 +0300 |
---|---|---|
committer | Valentin Popov <info@valentineus.link> | 2018-02-18 20:28:46 +0300 |
commit | ebf76795da6cb23eb26bfdddc664dd49a87effed (patch) | |
tree | 3e7959d14b2d751b9fe216f889dec641f563b91b | |
parent | 53c49b69de8e7489f3913177cfce850168870bf2 (diff) | |
download | local_webhooks-ebf76795da6cb23eb26bfdddc664dd49a87effed.tar.xz local_webhooks-ebf76795da6cb23eb26bfdddc664dd49a87effed.zip |
Change the location of the functions for working with the cache
-rw-r--r-- | lib.php | 34 | ||||
-rw-r--r-- | locallib.php | 44 |
2 files changed, 44 insertions, 34 deletions
@@ -45,40 +45,6 @@ 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 diff --git a/locallib.php b/locallib.php index a787f12..54d2bd4 100644 --- a/locallib.php +++ b/locallib.php @@ -25,6 +25,50 @@ defined("MOODLE_INTERNAL") || die(); /** + * 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); +} + +/** + * Clear the cache of the plugin. + * + * @return boolean + */ +function local_webhooks_cache_delete_all() { + $cache = cache::make("local_webhooks", "webhooks_services"); + return $cache->purge(); +} + +/** * Description of functions of the call of events * * @copyright 2017 "Valentin Popov" <info@valentineus.link> |