@@ -3,4 +3,148 @@ SimpleCacheRedis
3
3
4
4
An implementation of PSR-16 for Redis including encryption.
5
5
6
- Do not use yet.
6
+ This library extends
7
+ [ \AWonderPHP\SimpleCache\SimpleCache] ( https://github.com/AliceWonderMiscreations/SimpleCache )
8
+ but requires the ` devel ` branch for updates to the exception classes.
9
+
10
+ Once the ` devel ` branch of that project is merged into ` master ` and an official
11
+ release is made, an official release of this library will be made. The current
12
+ holdup, I am contemplating also creating a
13
+ [ memcached] ( https://www.memcached.org/ ) release and may need to make some
14
+ additional tweaks to the exception classes for that as well.
15
+
16
+ Though not tagged as an official release, this should be considered stable.
17
+
18
+ ---------------------------------------------------------------------------
19
+
20
+ This is an implementation of [ PSR-16] ( https://www.php-fig.org/psr/psr-16/ ) for
21
+ the Redis caching engine.
22
+
23
+ Two different classes are provided. The first just provides a PSR-16 compliant
24
+ interface to Redis and the second provides encryption of the cached data via
25
+ the libsodium extension.
26
+
27
+ Please refer to the files [ ` INSTALL.md ` ] ( INSTALL.md ) , [ ` USAGE.md ` ] ( USAGE.md ) ,
28
+ and [ ` SURVIVAL.md ` ] ( SURVIVAL.md ) for more information specific to
29
+ SimpleCacheRedis.
30
+
31
+ For instructions specific to the encryption option. see the file
32
+ [ ` SODIUM.md ` ] ( SODIUM.md ) .
33
+
34
+ Please refer to the file [ ` LICENSE.md ` ] ( LICENSE.md ) for the terms of the MIT
35
+ License this software is released under.
36
+
37
+ * [ About Redis Caching] ( #about-redis-caching )
38
+ * [ About PHP-FIG and PSR-16] ( #about-php-fig-and-psr-16 )
39
+ * [ Coding Standard] ( #coding-standard )
40
+ * [ About AWonderPHP] ( #about-awonderphp )
41
+
42
+
43
+ About Redis Caching
44
+ -------------------
45
+
46
+ Redis does * far more* than just behave as a caching engine, according to the
47
+ web site [ https://redis.io ] ( https://readis.io ) it provides an in-memory data
48
+ structure that can be used as a database, cache, and message broker.
49
+
50
+ For this PSR-16 implementation, using it as a PHP object cache is all that
51
+ matters, but redis itself is capable of some incredible things beyond the scope
52
+ of this class.
53
+
54
+ While looking at various benchmarks, it appears to me that in the use case
55
+ scenarios that best match a PSR-16 implementation, APCu is faster than Redis.
56
+ However there are several compelling reasons as to why Redis may be the better
57
+ choice for some situations:
58
+
59
+ * Redis cache survives a web server daemon restart.
60
+ * Redis cache (unless configured not to) survives a server reboot.
61
+ * Redis cache can be made accessible to other servers in your network.
62
+ * Redis cache can use a cluster if you have a lot of data you need to have
63
+ handled by a caching engine.
64
+
65
+ If you just have a single server scenario that does not need to share its
66
+ cached with other servers, APCu may be the better choice for PSR-16
67
+ caching needs, see\
68
+ [ SimpleCacheAPCu] ( https://github.com/AliceWonderMiscreations/SimpleCacheAPCu )
69
+ for a PSR-16 implementation for APCu.
70
+
71
+
72
+ About PHP-FIG and PSR-16
73
+ ------------------------
74
+
75
+ PHP-FIG is the [ PHP Framework Interop Group] ( https://www.php-fig.org/ ) . They
76
+ exist largely to create standards that make it easier for different developers
77
+ around the world to create different projects that will work well with each
78
+ other. PHP-FIG was a driving force behind the PSR-0 and PSR-4 auto-load
79
+ standards for example that make it * much much* easier to integrate PHP class
80
+ libraries written by other people into your web applications.
81
+
82
+ The PHP-FIG previously released PSR-6 as a Caching Interface standard but the
83
+ interface requirements of PSR-6 are beyond the needs of many web application
84
+ developers. KISS - ‘Keep It Simple Silly’ applies for many of us who do not
85
+ need some of the features PSR-6 requires.
86
+
87
+ To meet the needs of those of us who do not need what PSR-6 implements,
88
+ [ PSR-16] ( https://www.php-fig.org/psr/psr-16/ ) was developed and is now an
89
+ accepted standard.
90
+
91
+ When I read PSR-16, the defined interface it was not * that* different from my
92
+ own APCu caching class that I have personally been using for years. So I
93
+ decided to make my class meet the interface requirements.
94
+
95
+ Then a Redis user asked me if I could possibly adapt the library for Redis. So
96
+ I did and this is the result.
97
+
98
+
99
+ Coding Standard
100
+ ---------------
101
+
102
+ The coding standard used is primarily
103
+ [ PSR-2] ( https://www.php-fig.org/psr/psr-2/ ) except with the closing ` ?> `
104
+ allowed, and the addition of some
105
+ [ PHPDoc] ( https://en.wikipedia.org/wiki/PHPDoc ) requirements largely but not
106
+ completely borrowed from the
107
+ [ PEAR standard] ( http://pear.php.net/manual/en/standards.php ) .
108
+
109
+ The intent is switch PHPDoc standard to
110
+ [ PSR-5] ( https://github.com/phpDocumentor/fig-standards/blob/master/proposed/phpdoc.md )
111
+ if it ever becomes an accepted standard.
112
+
113
+ The ` phpcs ` sniff rules being used: [ psr2.phpcs.xml] ( psr2.phpcs.xml )
114
+
115
+
116
+ About AWonderPHP
117
+ ----------------
118
+
119
+ I may become homeless before the end of 2018. I do not know how to survive, I
120
+ try but what I try, it always seems to fail. This just is not a society people
121
+ like me are meant to be a part of.
122
+
123
+ If I do become homeless, I fear my mental health will deteriorate at an
124
+ accelerated rate and I do not want to witness that happening to myself.
125
+
126
+ AWonderPHP is my attempt to clean up and package a lot of the PHP classes I
127
+ personally use so that something of me will be left behind.
128
+
129
+ If you wish to help, please see the [ SURVIVAL.md] ( SURVIVAL.md ) file.
130
+
131
+ Thank you for your time.
132
+
133
+
134
+ -------------------------------------------------
135
+ __ EOF__
136
+
137
+
138
+
139
+
140
+
141
+
142
+
143
+
144
+
145
+
146
+
147
+
148
+
149
+
150
+
0 commit comments