1 <?php
2 /**
3 * Neevo - Tiny database layer for PHP. (http://neevo.smasty.net)
4 *
5 * This source file is subject to the MIT license that is bundled
6 * with this package in the file license.txt.
7 *
8 * Copyright (c) 2012 Smasty (http://smasty.net)
9 *
10 */
11
12 namespace Neevo\Cache;
13
14
15 /**
16 * Session cache storage.
17 * @author Smasty
18 */
19 class SessionStorage implements StorageInterface {
20
21
22 public function fetch($key){
23 return array_key_exists($key, $_SESSION['NeevoCache']) ? $_SESSION['NeevoCache'][$key] : null;
24 }
25
26
27 public function store($key, $value){
28 $_SESSION['NeevoCache'][$key] = $value;
29 }
30
31
32 public function flush(){
33 return!$_SESSION['NeevoCache'] = array();
34 }
35
36
37 }
38