Skip to content

Commit 0d5c359

Browse files
final documentation tweaks
1 parent 7fcbcb3 commit 0d5c359

File tree

4 files changed

+31
-28
lines changed

4 files changed

+31
-28
lines changed

Diff for: INSTALL.md

+1-4
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ If you want to use it in a project that is managed by
1717
`composer.json` file:
1818

1919
"require": {
20-
"awonderphp/simplecacheredis": "dev-master"
20+
"awonderphp/simplecacheredis": "^1.0"
2121
},
2222

2323
As long as your `composer.json` allows the [Packagist](https://packagist.org/)
@@ -38,9 +38,6 @@ your autoloader can find them first:
3838
Both of those libraries include exception classes that also must be installed
3939
where your autoloader can find them.
4040

41-
For `AWonderPHP/SimpleCache` make sure to use the `devel` branch, it has some
42-
exception functions required by this class.
43-
4441
Once those two dependencies are installed, there are two class files:
4542

4643
1. [`SimpleCacheRedis`](lib/SimpleCacheRedis.php)

Diff for: README.md

-16
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,6 @@
11
SimpleCacheRedis
22
================
33

4-
An implementation of PSR-16 for Redis including encryption.
5-
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-
204
This is an implementation of [PSR-16](https://www.php-fig.org/psr/psr-16/) for
215
the Redis caching engine.
226

Diff for: SODIUM.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ I do not *believe* PHP caches the contents of files read with
251251
`file_get_contents()` (I could be wrong about that) so storing the secret key
252252
in a configuration file is safer.
253253

254-
The class reads the file into a JSON string and then converts it an object.
254+
The class reads the file into a JSON string and then converts it to an object.
255255
The JSON string is then zeroed out using `sodium_memzero()` function.
256256

257257
Once they key has been verified as an actual working key, the key is set as a

Diff for: USAGE.md

+29-7
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,9 @@ For simple cases where Redis is running on the same server, this usually works:
3333
$redis = new \Redis();
3434
$redis->connect('127.0.0.1', 6379);
3535

36-
If you need more complexity than that, see the PECL class documentation. Once
37-
you have that object, you can create an instance of the `SimpleCacheRedis`
36+
If you need more complexity than that, see the
37+
[PECL Connection documentation](https://github.com/phpredis/phpredis/#connection).
38+
Once you have that object, you can create an instance of the `SimpleCacheRedis`
3839
class.
3940

4041
The easiest way to create an object of the `SimpleCacheRedis` class:
@@ -338,8 +339,7 @@ This allows you to specify the default number of seconds to use for the TTL
338339
when it is not specified in the `set()` or `setMultiple()` methods.
339340

340341
By default, the value is `0` which tells Redis to keep the `key => value`
341-
pair in cache until the server daemon is restarted or until the memory is
342-
needed for something else.
342+
pair in cache until you specifically replace it or specifically delete it.
343343

344344
Personally I think that rarely is a good idea. Web applications _SHOULD_
345345
either delete the cached entry or update the cached entry when the data is
@@ -376,11 +376,13 @@ It is needed for unit testing.
376376
Exceptions
377377
----------
378378

379-
There are two conditions that can cause SimpleCacheRedis to intentionally throw
380-
an exception:
379+
There are three conditions that can cause SimpleCacheRedis to intentionally
380+
throw an exception:
381381

382382
1. The data type used in a parameter is incorrect
383383
2. The data used in a parameter is not valid for use
384+
3. There is an issue connecting with the Redis server or if you are using the
385+
Sodium variant, there is an issue that will prevent encryption from working.
384386

385387
### Data Type Exceptions
386388

@@ -424,7 +426,27 @@ In those circumstances, this class will throw a:
424426

425427
Exception.
426428

427-
You can catch these based on `InvalidArgumentException` or the PSR implementation.
429+
You can catch these based on `\InvalidArgumentException` or the PSR
430+
implementation.
431+
432+
433+
### Setup Exceptions
434+
435+
Exceptions of this type only happen when either the class is not able to
436+
connect to the Redis server, you are using the Sodium variant and do not have
437+
the libsodium functions available, you specified a JSON configuration file that
438+
does not exist or is invalid, your encryption key is not valid, or something is
439+
broken resulting in the encryption nonce not being properly incremented.
440+
441+
In those circumstances, this class will throw a:
442+
443+
\AWonderPHP\SimpleCache\InvalidSetupException
444+
extends \ErrorException
445+
implements \Psr\SimpleCache\CacheException
446+
447+
Exception.
448+
449+
You can catch these based on `\ErrorException` or the PSR implementation.
428450

429451

430452
### About Catching Exceptions

0 commit comments

Comments
 (0)