Sokil\Mongo\Cache::deleteMatchingNoneOfTags PHP Метод

deleteMatchingNoneOfTags() публичный Метод

Delete documents by tag Document deletes if it not contains all passed tags
public deleteMatchingNoneOfTags ( array $tags )
$tags array
    public function deleteMatchingNoneOfTags(array $tags)
    {
        $this->collection->deleteDocuments(function (\Sokil\Mongo\Expression $e) use($tags) {
            return $e->whereNoneOf(Cache::FIELD_NAME_TAGS, $tags);
        });
        return $this;
    }

Usage Example

Пример #1
0
 public function testDeleteMatchingNoneOfTags()
 {
     $this->cache->setNeverExpired('php', 'PHP: Hypertext Processor', array('language', 'interpretable'))->setNeverExpired('c', 'C', array('language', 'compileable'));
     $this->assertEquals(2, count($this->cache));
     $this->cache->deleteMatchingNoneOfTags(array('language', 'compileable'));
     $this->assertEquals(1, count($this->cache));
     $this->assertTrue($this->cache->has('c'));
 }