forked from parse-community/parse-php-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathParseMemoryStorage.php
More file actions
57 lines (47 loc) · 962 Bytes
/
Copy pathParseMemoryStorage.php
File metadata and controls
57 lines (47 loc) · 962 Bytes
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<?php
namespace Parse;
/**
* ParseMemoryStorage - Uses non-persisted memory for storage.
* This is used by default if a PHP Session is not active.
*
* @author Fosco Marotto <fjm@fb.com>
*/
class ParseMemoryStorage implements ParseStorageInterface
{
/**
* @var array
*/
private $storage = [];
public function set($key, $value)
{
$this->storage[$key] = $value;
}
public function remove($key)
{
unset($this->storage[$key]);
}
public function get($key)
{
if (isset($this->storage[$key])) {
return $this->storage[$key];
}
return;
}
public function clear()
{
$this->storage = [];
}
public function save()
{
// No action required.
return;
}
public function getKeys()
{
return array_keys($this->storage);
}
public function getAll()
{
return $this->storage;
}
}