Skip to content

Commit 72934cd

Browse files
committed
fix: throw exception if deleteMatching used with memcached/wincache
1 parent 82991df commit 72934cd

8 files changed

Lines changed: 13 additions & 12 deletions

File tree

system/Cache/CacheInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public function delete(string $key);
6161
/**
6262
* Deletes items from the cache store matching a given pattern.
6363
*
64-
* @param string $pattern Cache items glob like pattern
64+
* @param string $pattern Cache items glob-style pattern
6565
*
6666
* @return mixed
6767
*/

system/Cache/Handlers/DummyHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ public function delete(string $key)
9191
/**
9292
* Deletes items from the cache store matching a given pattern.
9393
*
94-
* @param string $pattern Cache items glob like pattern
94+
* @param string $pattern Cache items glob-style pattern
9595
*
9696
* @return boolean
9797
*/

system/Cache/Handlers/FileHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ public function delete(string $key)
163163
/**
164164
* Deletes items from the cache store matching a given pattern.
165165
*
166-
* @param string $pattern Cache items glob like pattern
166+
* @param string $pattern Cache items glob-style pattern
167167
*
168168
* @return boolean
169169
*/

system/Cache/Handlers/MemcachedHandler.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -252,13 +252,13 @@ public function delete(string $key)
252252
/**
253253
* Deletes items from the cache store matching a given pattern.
254254
*
255-
* @param string $pattern Cache items glob like pattern
255+
* @param string $pattern Cache items glob-style pattern
256256
*
257-
* @return boolean
257+
* @throws Exception
258258
*/
259259
public function deleteMatching(string $pattern)
260260
{
261-
return false;
261+
throw new Exception('The deleteMatching method is not implemented for Memcached. You must select File, Redis or Predis handlers to use it.');
262262
}
263263

264264
//--------------------------------------------------------------------

system/Cache/Handlers/PredisHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ public function delete(string $key)
188188
/**
189189
* Deletes items from the cache store matching a given pattern.
190190
*
191-
* @param string $pattern Cache items glob like pattern
191+
* @param string $pattern Cache items glob-style pattern
192192
*
193193
* @return boolean
194194
*/

system/Cache/Handlers/RedisHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ public function delete(string $key)
226226
/**
227227
* Deletes items from the cache store matching a given pattern.
228228
*
229-
* @param string $pattern Cache items glob like pattern
229+
* @param string $pattern Cache items glob-style pattern
230230
*
231231
* @return boolean
232232
*/

system/Cache/Handlers/WincacheHandler.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
namespace CodeIgniter\Cache\Handlers;
1313

1414
use Config\Cache;
15+
use Exception;
1516

1617
/**
1718
* Cache handler for WinCache from Microsoft & IIS.
@@ -116,15 +117,15 @@ public function delete(string $key)
116117
/**
117118
* Deletes items from the cache store matching a given pattern.
118119
*
119-
* @param string $pattern Cache items glob like pattern
120+
* @param string $pattern Cache items glob-style pattern
120121
*
121-
* @return boolean
122+
* @throws Exception
122123
*
123124
* @codeCoverageIgnore
124125
*/
125126
public function deleteMatching(string $pattern)
126127
{
127-
return false;
128+
throw new Exception('The deleteMatching method is not implemented for Wincache. You must select File, Redis or Predis handlers to use it.');
128129
}
129130

130131
//--------------------------------------------------------------------

system/Test/Mock/MockCache.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ public function delete(string $key)
126126
/**
127127
* Deletes items from the cache store matching a given pattern.
128128
*
129-
* @param string $pattern Cache items pattern
129+
* @param string $pattern Cache items glob-style pattern
130130
*
131131
* @return boolean
132132
*/

0 commit comments

Comments
 (0)