summaryrefslogtreecommitdiff
path: root/app/Core/MemoryCache.php
blob: f80a66efe3b138abb3b2147fdb3882a28e16de36 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<?php

namespace Core;

class MemoryCache extends Cache
{
    private $storage = array();

    public function init()
    {
    }

    public function set($key, $value)
    {
        $this->storage[$key] = $value;
    }

    public function get($key)
    {
        return isset($this->storage[$key]) ? $this->storage[$key] : null;
    }

    public function flush()
    {
        $this->storage = array();
    }

    public function remove($key)
    {
        unset($this->storage[$key]);
    }
}