Skip to content

Commit 2188e3a

Browse files
committed
Add Null/Void cache implementation
This allows for functionality even when prerequisites are not matched. Non-persistent solution would potentially cause memory problems if used.
1 parent 930f50f commit 2188e3a

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

src/Builder/Null.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?php
2+
3+
namespace WPMultiObjectCache\Builder;
4+
5+
use Cache\Adapter\Common\AbstractCachePool;
6+
use Cache\Adapter\Void\VoidCachePool;
7+
use WPMultiObjectCache\PoolBuilderInterface;
8+
9+
class Null implements PoolBuilderInterface {
10+
11+
/**
12+
* Creates a pool
13+
*
14+
* @param array $config Config to use to create the pool.
15+
*
16+
* @return AbstractCachePool
17+
*/
18+
public function create( array $config = [] ) {
19+
return new VoidCachePool();
20+
}
21+
}

0 commit comments

Comments
 (0)