From 17128a889b7bc8cd20327c5ebfa37ee7b4e0237f Mon Sep 17 00:00:00 2001 From: Jiiks Date: Sun, 12 Aug 2018 17:40:26 +0300 Subject: [PATCH] add cache module --- client/src/modules/cache.js | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 client/src/modules/cache.js diff --git a/client/src/modules/cache.js b/client/src/modules/cache.js new file mode 100644 index 00000000..1e18a289 --- /dev/null +++ b/client/src/modules/cache.js @@ -0,0 +1,27 @@ +/** + * BetterDiscord Cache Module + * Copyright (c) 2015-present Jiiks/JsSucks - https://github.com/Jiiks / https://github.com/JsSucks + * All rights reserved. + * https://betterdiscord.net + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. +*/ +const CACHE = []; +export default class Cache { + + static get cache() { + return CACHE; + } + + static push(where, data) { + if (!this.cache[where]) this.cache[where] = []; + this.cache[where].push(data); + } + + static find(where, what) { + if (!this.cache[where]) this.cache[where] = []; + return this.cache[where].find(what); + } + +}