function LruMemoryCacheTest::getLruMemoryCache
Creates a LRU cache for testing.
Parameters
int $slots: The number of slots in the LRU cache.
Return value
\Drupal\Core\Cache\MemoryCache\LruMemoryCache The LRU cache.
5 calls to LruMemoryCacheTest::getLruMemoryCache()
- LruMemoryCacheTest::testGetSetDelete in core/
tests/ Drupal/ Tests/ Core/ Cache/ LruMemoryCacheTest.php - Tests getting, setting and deleting items from the LRU memory cache.
- LruMemoryCacheTest::testInvalidate in core/
tests/ Drupal/ Tests/ Core/ Cache/ LruMemoryCacheTest.php - Tests invalidation from the LRU memory cache.
- LruMemoryCacheTest::testInvalidateNumeric in core/
tests/ Drupal/ Tests/ Core/ Cache/ LruMemoryCacheTest.php - Tests invalidation with numeric keys from the LRU memory cache.
- LruMemoryCacheTest::testSetMultiple in core/
tests/ Drupal/ Tests/ Core/ Cache/ LruMemoryCacheTest.php - Tests setting multiple items in the LRU memory cache.
- LruMemoryCacheTest::testSetNumericKeys in core/
tests/ Drupal/ Tests/ Core/ Cache/ LruMemoryCacheTest.php - Tests setting items with numeric keys in the LRU memory cache.
File
-
core/
tests/ Drupal/ Tests/ Core/ Cache/ LruMemoryCacheTest.php, line 382
Class
- LruMemoryCacheTest
- @coversDefaultClass \Drupal\Core\Cache\MemoryCache\LruMemoryCache @group Cache
Namespace
Drupal\Tests\Core\CacheCode
private function getLruMemoryCache(int $slots) : LruMemoryCache {
$time_mock = $this->createMock(TimeInterface::class);
$time_mock->expects($this->any())
->method('getRequestTime')
->willReturnCallback('time');
return new LruMemoryCache($time_mock, $slots);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.