26 virtual _<T> load(
const K& key) = 0;
28 virtual bool isShouldBeCached(
const K& key,
const _<T>& image) {
34 static _<T> get(
const K& key) {
35 Cache& i = Container::inst();
37 std::unique_lock lock(i.mSync);
38 if (
auto i = Container::inst().mContainer.contains(key)) {
42 auto value = i.load(key);
43 if (i.isShouldBeCached(key, value)) {
49 static void put(
const K& key,
_<T> value) {
50 std::unique_lock lock(Container::inst().mSync);
51 Container::inst().mContainer[key] = value;
54 static void cleanup() {
55 std::unique_lock lock(Container::inst().mSync);
56 Container::inst().mContainer.clear();