https://github.com/alicewondermiscreations/simplecacheredis
An implementation of the PSR-16 SimpleCache Interface for Redis with optional AEAD encryption
https://github.com/alicewondermiscreations/simplecacheredis
cache libsodium libsodium-php php php-library php7 psr-16 redis
Last synced: 26 days ago
JSON representation
An implementation of the PSR-16 SimpleCache Interface for Redis with optional AEAD encryption
- Host: GitHub
- URL: https://github.com/alicewondermiscreations/simplecacheredis
- Owner: AliceWonderMiscreations
- License: mit
- Created: 2018-03-19T16:28:51.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2018-04-30T23:04:27.000Z (about 8 years ago)
- Last Synced: 2025-06-06T18:11:31.850Z (about 1 year ago)
- Topics: cache, libsodium, libsodium-php, php, php-library, php7, psr-16, redis
- Language: PHP
- Homepage:
- Size: 60.5 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.md
Awesome Lists containing this project
README
SimpleCacheRedis
================
This is an implementation of [PSR-16](https://www.php-fig.org/psr/psr-16/) for
the Redis caching engine.
Two different classes are provided. The first just provides a PSR-16 compliant
interface to Redis and the second provides encryption of the cached data via
the libsodium extension.
Please refer to the files [`INSTALL.md`](INSTALL.md), [`USAGE.md`](USAGE.md),
and [`SURVIVAL.md`](SURVIVAL.md) for more information specific to
SimpleCacheRedis.
For instructions specific to the encryption option. see the file
[`SODIUM.md`](SODIUM.md).
Please refer to the file [`LICENSE.md`](LICENSE.md) for the terms of the MIT
License this software is released under.
* [About Redis Caching](#about-redis-caching)
* [About PHP-FIG and PSR-16](#about-php-fig-and-psr-16)
* [Coding Standard](#coding-standard)
* [About AWonderPHP](#about-awonderphp)
About Redis Caching
-------------------
Redis does *far more* than just behave as a caching engine, according to the
web site [https://redis.io](https://readis.io) it provides an in-memory data
structure that can be used as a database, cache, and message broker.
For this PSR-16 implementation, using it as a PHP object cache is all that
matters, but redis itself is capable of some incredible things beyond the scope
of this class.
While looking at various benchmarks, it appears to me that in the use case
scenarios that best match a PSR-16 implementation, APCu is faster than Redis.
However there are several compelling reasons as to why Redis may be the better
choice for some situations:
* Redis cache survives a web server daemon restart.
* Redis cache (unless configured not to) survives a server reboot.
* Redis cache can be made accessible to other servers in your network.
* Redis cache can use a cluster if you have a lot of data you need to have
handled by a caching engine.
If you just have a single server scenario that does not need to share its
cached with other servers, APCu may be the better choice for PSR-16
caching needs, see\
[SimpleCacheAPCu](https://github.com/AliceWonderMiscreations/SimpleCacheAPCu)
for a PSR-16 implementation for APCu.
About PHP-FIG and PSR-16
------------------------
PHP-FIG is the [PHP Framework Interop Group](https://www.php-fig.org/). They
exist largely to create standards that make it easier for different developers
around the world to create different projects that will work well with each
other. PHP-FIG was a driving force behind the PSR-0 and PSR-4 auto-load
standards for example that make it *much much* easier to integrate PHP class
libraries written by other people into your web applications.
The PHP-FIG previously released PSR-6 as a Caching Interface standard but the
interface requirements of PSR-6 are beyond the needs of many web application
developers. KISS - ‘Keep It Simple Silly’ applies for many of us who do not
need some of the features PSR-6 requires.
To meet the needs of those of us who do not need what PSR-6 implements,
[PSR-16](https://www.php-fig.org/psr/psr-16/) was developed and is now an
accepted standard.
When I read PSR-16, the defined interface it was not *that* different from my
own APCu caching class that I have personally been using for years. So I
decided to make my class meet the interface requirements.
Then a Redis user asked me if I could possibly adapt the library for Redis. So
I did and this is the result.
Coding Standard
---------------
The coding standard used is primarily
[PSR-2](https://www.php-fig.org/psr/psr-2/) except with the closing `?>`
allowed, and the addition of some
[PHPDoc](https://en.wikipedia.org/wiki/PHPDoc) requirements largely but not
completely borrowed from the
[PEAR standard](http://pear.php.net/manual/en/standards.php).
The intent is switch PHPDoc standard to
[PSR-5](https://github.com/phpDocumentor/fig-standards/blob/master/proposed/phpdoc.md)
if it ever becomes an accepted standard.
The `phpcs` sniff rules being used: [psr2.phpcs.xml](psr2.phpcs.xml)
About AWonderPHP
----------------
I may become homeless before the end of 2018. I do not know how to survive, I
try but what I try, it always seems to fail. This just is not a society people
like me are meant to be a part of.
If I do become homeless, I fear my mental health will deteriorate at an
accelerated rate and I do not want to witness that happening to myself.
AWonderPHP is my attempt to clean up and package a lot of the PHP classes I
personally use so that something of me will be left behind.
If you wish to help, please see the [SURVIVAL.md](SURVIVAL.md) file.
Thank you for your time.
-------------------------------------------------
__EOF__