Skip to content

Commit 5f2e663

Browse files
committed
Update readme
Added verbosity with regard to PSR-16 compatibility.
1 parent fd6d24c commit 5f2e663

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

README.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,13 @@ transients as storage. Exceptions are raised, interfaces implemented, and true f
2323
Each instance of the cache pool is logically independent from other instances, provided that it is given a unique
2424
name. The application is once again in control, and modules that use cache can become platform agnostic.
2525

26+
### Compatibility
27+
- `CachePool` and `CachePoolFactory` offer best-practices error handling, throwing meaningful exceptions
28+
when something goes wrong. This violates PSR-16, but allows you to know what is failing.
29+
- `SilentPool` and `SilentPoolFactory` offer PSR-16 compatibility at the cost of error handling,
30+
hiding exceptions, and returning standards-compatible values. This complies with PSR-16, but at the cost of
31+
clarity and verbosity.
32+
2633
### Usage
2734
```php
2835
/*
@@ -31,10 +38,12 @@ name. The application is once again in control, and modules that use cache can b
3138
use wpdb;
3239
use Psr\SimpleCache\CacheInterface;
3340
use WpOop\TransientCache\CachePoolFactory;
41+
use WpOop\TransientCache\SilentPoolFactory;
3442

3543
/* @var $wpdb wpdb */
3644
$factory = new CachePoolFactory($wpdb);
37-
45+
// Optionally hide exceptions for PSR-16 compatibility
46+
$factory = new SilentPoolFactory($factory); // Optional, and not recommended for testing environments!
3847

3948
/*
4049
* Create cache pools - usually somewhere else

0 commit comments

Comments
 (0)