1111
1212namespace Cache \CacheBundle \Cache ;
1313
14- use Aequasi \Cache \CacheItem ;
15- use Aequasi \Cache \CachePool ;
1614use Psr \Cache \CacheItemInterface ;
1715use Psr \Cache \CacheItemPoolInterface ;
16+ use Psr \Cache \InvalidArgumentException ;
1817
1918/**
2019 * @author Aaron Scherer <[email protected] > 2120 */
22- class LoggingCachePool extends CachePool
21+ class LoggingCachePool implements CacheItemPoolInterface
2322{
2423 /**
2524 * @var array $calls
@@ -70,7 +69,7 @@ public function deleteItem($key)
7069
7170 public function save (CacheItemInterface $ item )
7271 {
73- $ itemClone = clone $ item ;
72+ $ itemClone = clone $ item ;
7473 $ itemClone ->set (sprintf ('<DATA:%s ' , gettype ($ item ->get ())));
7574
7675 $ call = $ this ->timeCall (__FUNCTION__ , [$ item ]);
@@ -82,21 +81,68 @@ public function save(CacheItemInterface $item)
8281
8382 /**
8483 * @param string $name
85- * @param $arguments
84+ * @param array $arguments
8685 *
8786 * @return object
8887 */
89- private function timeCall ($ name , $ arguments )
88+ private function timeCall ($ name , array $ arguments = null )
9089 {
9190 $ start = microtime (true );
9291 $ result = call_user_func_array ([$ this ->cachePool , $ name ], $ arguments );
9392 $ time = microtime (true ) - $ start ;
9493
95- $ object = (object ) compact ('name ' , 'arguments ' , 'start ' , 'time ' , 'result ' );
94+ $ object = (object )compact ('name ' , 'arguments ' , 'start ' , 'time ' , 'result ' );
9695
9796 return $ object ;
9897 }
9998
99+ public function getItems (array $ keys = [])
100+ {
101+ $ call = $ this ->timeCall (__FUNCTION__ , [$ keys ]);
102+ $ result = $ call ->result ;
103+ $ call ->result = sprintf ('<DATA:%s> ' , gettype ($ result ));
104+
105+ $ this ->calls [] = $ call ;
106+
107+ return $ result ;
108+ }
109+
110+ public function clear ()
111+ {
112+ $ call = $ this ->timeCall (__FUNCTION__ );
113+ $ this ->calls [] = $ call ;
114+
115+ return $ call ->result ;
116+ }
117+
118+ public function deleteItems (array $ keys )
119+ {
120+ $ call = $ this ->timeCall (__FUNCTION__ , [$ keys ]);
121+ $ this ->calls [] = $ call ;
122+
123+ return $ call ->result ;
124+ }
125+
126+ public function saveDeferred (CacheItemInterface $ item )
127+ {
128+ $ itemClone = clone $ item ;
129+ $ itemClone ->set (sprintf ('<DATA:%s ' , gettype ($ item ->get ())));
130+
131+ $ call = $ this ->timeCall (__FUNCTION__ , [$ item ]);
132+ $ call ->arguments = ['<CacheItem> ' , $ itemClone ];
133+ $ this ->calls [] = $ call ;
134+
135+ return $ call ->result ;
136+ }
137+
138+ public function commit ()
139+ {
140+ $ call = $ this ->timeCall (__FUNCTION__ );
141+ $ this ->calls [] = $ call ;
142+
143+ return $ call ->result ;
144+ }
145+
100146 /**
101147 * @return array
102148 */
0 commit comments