diff options
author | Bart Visscher <bartv@thisnet.nl> | 2013-06-24 08:27:25 +0200 |
---|---|---|
committer | Bart Visscher <bartv@thisnet.nl> | 2013-06-24 08:27:25 +0200 |
commit | 377e9a8677afc92bca61fb1bb055901db8457896 (patch) | |
tree | 43d98d7d0d00823714cc6b23aa9366dc93a42609 /lib/session/memory.php | |
parent | 0bff53eb639eb0271e9c20df91a18247f88a3e1f (diff) | |
parent | aaecfa18edf7c690f06d0ce460bd3a7a98269845 (diff) | |
download | nextcloud-server-377e9a8677afc92bca61fb1bb055901db8457896.tar.gz nextcloud-server-377e9a8677afc92bca61fb1bb055901db8457896.zip |
Merge branch 'master' into doctrine
Diffstat (limited to 'lib/session/memory.php')
-rw-r--r-- | lib/session/memory.php | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/lib/session/memory.php b/lib/session/memory.php new file mode 100644 index 00000000000..c148ff4b9b9 --- /dev/null +++ b/lib/session/memory.php @@ -0,0 +1,63 @@ +<?php +/** + * Copyright (c) 2013 Robin Appelman <icewind@owncloud.com> + * This file is licensed under the Affero General Public License version 3 or + * later. + * See the COPYING-README file. + */ + +namespace OC\Session; + +/** + * Class Internal + * + * store session data in an in-memory array, not persistance + * + * @package OC\Session + */ +class Memory extends Session { + protected $data; + + public function __construct($name) { + //no need to use $name since all data is already scoped to this instance + $this->data = array(); + } + + /** + * @param string $key + * @param mixed $value + */ + public function set($key, $value) { + $this->data[$key] = $value; + } + + /** + * @param string $key + * @return mixed + */ + public function get($key) { + if (!$this->exists($key)) { + return null; + } + return $this->data[$key]; + } + + /** + * @param string $key + * @return bool + */ + public function exists($key) { + return isset($this->data[$key]); + } + + /** + * @param string $key + */ + public function remove($key) { + unset($this->data[$key]); + } + + public function clear() { + $this->data = array(); + } +} |