Skip to content

Commit da2c837

Browse files
documentation work
1 parent 6a0b452 commit da2c837

File tree

4 files changed

+987
-1
lines changed

4 files changed

+987
-1
lines changed

Diff for: INSTALL.md

+71
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
SimpleCacheRedis Installation
2+
=============================
3+
4+
You need to have the [Redis](https://redis.io/) server installed and available.
5+
If you are using Linux a suitable version is *probably* packaged in your
6+
distribution software repository.
7+
8+
You need to have the [PECL Redis](https://pecl.php.net/package/redis) extension
9+
installed. I have tested with version 3.1.6 in PHP 7.1 and have used
10+
[travis-ci](https://travis-ci.org/) to test version 4.0.0 in PHP 7.1 and PHP
11+
7.2.
12+
13+
SimpleCacheRedis is a library, it is not a stand alone application.
14+
15+
If you want to use it in a project that is managed by
16+
[Composer](https://getcomposer.org/), make sure the following is within your
17+
`composer.json` file:
18+
19+
"require": {
20+
"awonderphp/simplecacheredis": "dev-master"
21+
},
22+
23+
As long as your `composer.json` allows the [Packagist](https://packagist.org/)
24+
repository, that should pull in this library when you run the command:
25+
26+
composer install
27+
28+
29+
Manual Installation
30+
-------------------
31+
32+
For manual installation, there are two other libraries you must install where
33+
your autoloader can find them first:
34+
35+
1. [`psr/simple-cache`](https://github.com/php-fig/simple-cache/tree/master/src)
36+
2. [`AWonderPHP/SimpleCache`](https://github.com/AliceWonderMiscreations/SimpleCache/)
37+
38+
Both of those libraries include exception classes that also must be installed
39+
where your autoloader can find them.
40+
41+
For `AWonderPHP/SimpleCache` make sure to use the `devel` branch, it has some
42+
exception functions required by this class.
43+
44+
Once those two dependencies are installed, there are two class files:
45+
46+
1. [`SimpleCacheRedis`](blob/master/lib/SimpleCacheRedis.php)
47+
2. [`SimpleCacheRedisSodium`](blob/master/lib/SimpleCacheRedisSodium.php)
48+
49+
The first class provides PSR-16 without encryption, the second provides PSR-16
50+
with encryption.
51+
52+
Both files use the namespace `AWonderPHP\SimpleCacheRedis`.
53+
54+
55+
RPM Installation
56+
----------------
57+
58+
I have started a project called
59+
[PHP Composer Class Manager](https://github.com/AliceWonderMiscreations/php-ccm)
60+
but it is not yet ready for deployment, and as of today (March 19 2018) it
61+
will likely be awhile.
62+
63+
64+
Class Usage
65+
-----------
66+
67+
Please see the file [`USAGE.md`](USAGE.md) for class usage.
68+
69+
70+
-------------------------------------------------
71+
__EOF__

Diff for: README.md

+145-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,148 @@ SimpleCacheRedis
33

44
An implementation of PSR-16 for Redis including encryption.
55

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

Comments
 (0)