Skip to content

Commit cb24968

Browse files
committed
phpsec#38 Abstract class desribing the phpSec storage interface class.
1 parent 1725716 commit cb24968

File tree

1 file changed

+68
-0
lines changed

1 file changed

+68
-0
lines changed

phpsec/phpsec.store.php

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
<?php
2+
/**
3+
phpSec - A PHP security library
4+
5+
@author Audun Larsen <larsen@xqus.com>
6+
@copyright Copyright (c) Audun Larsen, 2011
7+
@link https://github.com/xqus/phpSec
8+
@license http://opensource.org/licenses/mit-license.php The MIT License
9+
@package phpSec
10+
*/
11+
12+
/* Abstract class desribing the phpSec storage interface class. */
13+
abstract class phpsecStore {
14+
15+
/**
16+
* Open/prepeare the storage.
17+
*
18+
* @param string $target
19+
* The exact storage target as configured by user.
20+
*
21+
* @return bool
22+
* Returns true on success and false on error.
23+
*/
24+
abstract public function __construct($target);
25+
26+
/**
27+
* Read data from storage.
28+
*
29+
* @param string $type
30+
* Type of data (session, cache, etc.).
31+
*
32+
* @param string $id
33+
* Unique identifier.
34+
*
35+
* @return mixed
36+
* Returns data.
37+
*/
38+
abstract public function read($type, $id);
39+
40+
/**
41+
* Write data to storeage.
42+
*
43+
* @param string $type
44+
* Type of data (session, cache, etc.).
45+
*
46+
* @param string $id
47+
* Unique identifier.
48+
*
49+
* @return bool
50+
* Returns true on success, false on error.
51+
*/
52+
abstract public function write($type, $id);
53+
54+
/**
55+
* Delete data from storeage.
56+
*
57+
* @param string $type
58+
* Type of data (session, cache, etc.).
59+
*
60+
* @param string $id
61+
* Unique identifier.
62+
*
63+
* @return bool
64+
* Returns true on success, false on error.
65+
*/
66+
abstract public function delete($type, $id);
67+
68+
}

0 commit comments

Comments
 (0)