delete() public méthode

Will attempt to remove specified keys from the user space cache.
public delete ( array $keys ) : boolean
$keys array Keys to uniquely identify the cached items.
Résultat boolean `true` on successful delete, `false` otherwise.
Exemple #1
0
 public function testDeleteWithScope()
 {
     $adapter = new File(array('scope' => 'primary'));
     $time = time() + 60;
     $keys = array('primary_key1' => 'test1', 'key1' => 'test2');
     foreach ($keys as $key => $data) {
         $path = Libraries::get(true, 'resources') . "/tmp/cache/{$key}";
         file_put_contents($path, "{:expiry:{$time}}\n{$data}");
     }
     $keys = array('key1');
     $adapter->delete($keys);
     $file = Libraries::get(true, 'resources') . "/tmp/cache/key1";
     $result = file_exists($file);
     $this->assertTrue($result);
     $file = Libraries::get(true, 'resources') . "/tmp/cache/primary_key1";
     $result = file_exists($file);
     $this->assertFalse($result);
 }