diff options
author | Valentin Popov <info@valentineus.link> | 2018-03-12 13:20:30 +0300 |
---|---|---|
committer | Valentin Popov <info@valentineus.link> | 2018-03-12 13:20:30 +0300 |
commit | e0a43273a3b72d000623472208336cbb333b356a (patch) | |
tree | 20659535c6173ea3068cea5ff31a83130160f4bb | |
parent | cce50b316d35fda03a1b7b741a66261abb6c4b86 (diff) | |
download | local_webhooks-e0a43273a3b72d000623472208336cbb333b356a.tar.xz local_webhooks-e0a43273a3b72d000623472208336cbb333b356a.zip |
Added constants to the cache
Signed-off-by: Valentin Popov <info@valentineus.link>
-rw-r--r-- | locallib.php | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/locallib.php b/locallib.php index aac8c58..6ad80b6 100644 --- a/locallib.php +++ b/locallib.php @@ -24,6 +24,9 @@ defined("MOODLE_INTERNAL") || die(); +define("LOCAL_WEBHOOKS_NAME_CACHE_REPOSITORY", "webhooks_services"); +define("LOCAL_WEBHOOKS_NAME_PLUGIN", "local_webhooks"); + /** * Get data from the cache by key. * @@ -31,7 +34,7 @@ defined("MOODLE_INTERNAL") || die(); * @return array */ function local_webhooks_cache_get($eventname) { - $cache = cache::make("local_webhooks", "webhooks_services"); + $cache = cache::make(LOCAL_WEBHOOKS_NAME_PLUGIN, LOCAL_WEBHOOKS_NAME_CACHE_REPOSITORY); return $cache->get($eventname); } @@ -43,7 +46,7 @@ function local_webhooks_cache_get($eventname) { * @return boolean */ function local_webhooks_cache_set($eventname, $recordlist = array()) { - $cache = cache::make("local_webhooks", "webhooks_services"); + $cache = cache::make(LOCAL_WEBHOOKS_NAME_PLUGIN, LOCAL_WEBHOOKS_NAME_CACHE_REPOSITORY); return $cache->set($eventname, $recordlist); } @@ -54,7 +57,7 @@ function local_webhooks_cache_set($eventname, $recordlist = array()) { * @return boolean */ function local_webhooks_cache_delete($eventname) { - $cache = cache::make("local_webhooks", "webhooks_services"); + $cache = cache::make(LOCAL_WEBHOOKS_NAME_PLUGIN, LOCAL_WEBHOOKS_NAME_CACHE_REPOSITORY); return $cache->delete($eventname); } @@ -64,7 +67,7 @@ function local_webhooks_cache_delete($eventname) { * @return boolean */ function local_webhooks_cache_reset() { - $cache = cache::make("local_webhooks", "webhooks_services"); + $cache = cache::make(LOCAL_WEBHOOKS_NAME_PLUGIN, LOCAL_WEBHOOKS_NAME_CACHE_REPOSITORY); return $cache->purge(); } |