Home
last modified time | relevance | path

Searched refs:cache (Results 1 – 25 of 3510) sorted by relevance

12345678910>>...141

/external/python/cachetools/tests/
D__init__.py10 cache = self.Cache(maxsize=1)
11 self.assertEqual(0, len(cache))
12 self.assertEqual(1, cache.maxsize)
13 self.assertEqual(0, cache.currsize)
14 self.assertEqual(1, cache.getsizeof(None))
15 self.assertEqual(1, cache.getsizeof(""))
16 self.assertEqual(1, cache.getsizeof(0))
17 self.assertTrue(repr(cache).startswith(cache.__class__.__name__))
20 cache = self.Cache(maxsize=2)
22 cache.update({1: 1, 2: 2})
[all …]
Dtest_ttl.py32 cache = TTLCache(maxsize=2, ttl=1, timer=Timer())
33 self.assertEqual(0, cache.timer())
34 self.assertEqual(1, cache.ttl)
36 cache[1] = 1
37 self.assertEqual({1}, set(cache))
38 self.assertEqual(1, len(cache))
39 self.assertEqual(1, cache[1])
41 cache.timer.tick()
42 self.assertEqual({1}, set(cache))
43 self.assertEqual(1, len(cache))
[all …]
/external/rust/crates/hashlink/tests/
Dlru_cache.rs5 let mut cache = LruCache::new(2); in test_put_and_get() localVariable
6 cache.insert(1, 10); in test_put_and_get()
7 cache.insert(2, 20); in test_put_and_get()
8 assert_eq!(cache.get_mut(&1), Some(&mut 10)); in test_put_and_get()
9 assert_eq!(cache.get_mut(&2), Some(&mut 20)); in test_put_and_get()
10 assert_eq!(cache.len(), 2); in test_put_and_get()
15 let mut cache = LruCache::new(1); in test_put_update() localVariable
16 cache.insert("1", 10); in test_put_update()
17 cache.insert("1", 19); in test_put_update()
18 assert_eq!(cache.get_mut("1"), Some(&mut 19)); in test_put_update()
[all …]
/external/swiftshader/tests/SystemUnitTests/
DLRUCacheTests.cpp27 void checkRange(const Cache &cache, std::vector<std::pair<typename Cache::Key, typename Cache::Data… in checkRange() argument
30 for(auto it : cache) in checkRange()
46 LRUCache<std::string, std::string> cache(8); in TEST() local
47 ASSERT_EQ(cache.lookup(""), ""); in TEST()
48 ASSERT_EQ(cache.lookup("123"), ""); in TEST()
50 for(auto ignored : cache) in TEST()
63 LRUCache<std::string, std::string> cache(4); in TEST() local
65 cache.add("1", "one"); in TEST()
66 cache.add("2", "two"); in TEST()
67 cache.add("3", "three"); in TEST()
[all …]
/external/cronet/net/base/
Dexpiring_cache_unittest.cc39 Cache cache(kMaxCacheEntries); in TEST() local
43 EXPECT_EQ(0U, cache.size()); in TEST()
46 EXPECT_FALSE(cache.Get("entry1", now)); in TEST()
47 cache.Put("entry1", "test1", now, now + kTTL); in TEST()
48 EXPECT_THAT(cache.Get("entry1", now), Pointee(StrEq("test1"))); in TEST()
49 EXPECT_EQ(1U, cache.size()); in TEST()
55 EXPECT_FALSE(cache.Get("entry2", now)); in TEST()
56 cache.Put("entry2", "test2", now, now + kTTL); in TEST()
57 EXPECT_THAT(cache.Get("entry2", now), Pointee(StrEq("test2"))); in TEST()
58 EXPECT_EQ(2U, cache.size()); in TEST()
[all …]
/external/libnl/lib/
Dcache.c63 int nl_cache_nitems(struct nl_cache *cache) in nl_cache_nitems() argument
65 return cache->c_nitems; in nl_cache_nitems()
73 int nl_cache_nitems_filter(struct nl_cache *cache, struct nl_object *filter) in nl_cache_nitems_filter() argument
78 if (cache->c_ops == NULL) in nl_cache_nitems_filter()
81 nl_list_for_each_entry(obj, &cache->c_items, ce_list) { in nl_cache_nitems_filter()
96 int nl_cache_is_empty(struct nl_cache *cache) in nl_cache_is_empty() argument
98 return nl_list_empty(&cache->c_items); in nl_cache_is_empty()
105 struct nl_cache_ops *nl_cache_get_ops(struct nl_cache *cache) in nl_cache_get_ops() argument
107 return cache->c_ops; in nl_cache_get_ops()
114 struct nl_object *nl_cache_get_first(struct nl_cache *cache) in nl_cache_get_first() argument
[all …]
/external/guava/guava-tests/test/com/google/common/cache/
DCacheBuilderGwtTest.java17 package com.google.common.cache;
54 final Cache<Integer, Integer> cache = CacheBuilder.newBuilder().build(); in testLoader() local
66 cache.put(0, 10); in testLoader()
68 assertEquals(Integer.valueOf(10), cache.get(0, loader)); in testLoader()
69 assertEquals(Integer.valueOf(1), cache.get(20, loader)); in testLoader()
70 assertEquals(Integer.valueOf(2), cache.get(34, loader)); in testLoader()
72 cache.invalidate(0); in testLoader()
73 assertEquals(Integer.valueOf(3), cache.get(0, loader)); in testLoader()
75 cache.put(0, 10); in testLoader()
76 cache.invalidateAll(); in testLoader()
[all …]
DCacheEvictionTest.java15 package com.google.common.cache;
17 import static com.google.common.cache.TestingCacheLoaders.identityLoader;
18 import static com.google.common.cache.TestingRemovalListeners.countingRemovalListener;
19 import static com.google.common.cache.TestingWeighers.constantWeigher;
20 import static com.google.common.cache.TestingWeighers.intKeyWeigher;
21 import static com.google.common.cache.TestingWeighers.intValueWeigher;
25 import com.google.common.cache.CacheTesting.Receiver;
26 import com.google.common.cache.TestingCacheLoaders.IdentityLoader;
27 import com.google.common.cache.TestingRemovalListeners.CountingRemovalListener;
44 LoadingCache<Object, Object> cache = CacheBuilder.newBuilder().maximumSize(i).build(loader); in testEviction_setMaxSegmentSize() local
[all …]
/external/guava/android/guava-tests/test/com/google/common/cache/
DCacheBuilderGwtTest.java17 package com.google.common.cache;
54 final Cache<Integer, Integer> cache = CacheBuilder.newBuilder().build(); in testLoader() local
66 cache.put(0, 10); in testLoader()
68 assertEquals(Integer.valueOf(10), cache.get(0, loader)); in testLoader()
69 assertEquals(Integer.valueOf(1), cache.get(20, loader)); in testLoader()
70 assertEquals(Integer.valueOf(2), cache.get(34, loader)); in testLoader()
72 cache.invalidate(0); in testLoader()
73 assertEquals(Integer.valueOf(3), cache.get(0, loader)); in testLoader()
75 cache.put(0, 10); in testLoader()
76 cache.invalidateAll(); in testLoader()
[all …]
DCacheEvictionTest.java15 package com.google.common.cache;
17 import static com.google.common.cache.TestingCacheLoaders.identityLoader;
18 import static com.google.common.cache.TestingRemovalListeners.countingRemovalListener;
19 import static com.google.common.cache.TestingWeighers.constantWeigher;
20 import static com.google.common.cache.TestingWeighers.intKeyWeigher;
21 import static com.google.common.cache.TestingWeighers.intValueWeigher;
25 import com.google.common.cache.CacheTesting.Receiver;
26 import com.google.common.cache.TestingCacheLoaders.IdentityLoader;
27 import com.google.common.cache.TestingRemovalListeners.CountingRemovalListener;
44 LoadingCache<Object, Object> cache = CacheBuilder.newBuilder().maximumSize(i).build(loader); in testEviction_setMaxSegmentSize() local
[all …]
/external/XNNPACK/test/
Dcode-cache.cc14 static void* cache_end(const xnn_code_cache* cache) { in cache_end() argument
15 …urn reinterpret_cast<void *>(reinterpret_cast<uintptr_t>(cache->cache.code.start) + cache->cache.c… in cache_end()
18 static void write_code(xnn_code_cache* cache, const std::string& str) { in write_code() argument
19 ASSERT_GE(cache->cache.code.capacity - cache->cache.code.size, str.length()); in write_code()
20 std::memcpy(cache_end(cache), str.data(), str.length()); in write_code()
21 cache->cache.code.size += str.length(); in write_code()
27 xnn_code_cache cache; in TEST() local
28 EXPECT_EQ(xnn_status_success, xnn_init_code_cache(&cache)); in TEST()
29 EXPECT_EQ(xnn_status_success, xnn_release_code_cache(&cache)); in TEST()
41 xnn_code_cache cache; in TEST() local
[all …]
Dweights-cache.cc20 static void* cache_end(const xnn_weights_cache* cache) { in cache_end() argument
21 …n reinterpret_cast<void *>(reinterpret_cast<uintptr_t>(cache->cache.weights.start) + cache->cache.… in cache_end()
24 static void write_weights(xnn_weights_cache* cache, const std::string& str) { in write_weights() argument
25 ASSERT_NE(nullptr, xnn_reserve_space_in_weights_cache(cache, str.length())); in write_weights()
26 std::memcpy(cache_end(cache), str.data(), str.length()); in write_weights()
32 struct xnn_weights_cache cache; in TEST() local
33 EXPECT_EQ(xnn_status_success, xnn_init_weights_cache(&cache)); in TEST()
34 EXPECT_EQ(xnn_status_success, xnn_release_weights_cache(&cache)); in TEST()
41 struct xnn_weights_cache cache; in TEST() local
42 EXPECT_EQ(xnn_status_success, xnn_init_weights_cache_with_size(&cache, four_mb)); in TEST()
[all …]
/external/squashfs-tools/squashfs-tools/
Dcaches-queues-lists.c269 INSERT_HASH_TABLE(cache, struct cache, CALCULATE_CACHE_HASH, index, hash)
272 REMOVE_HASH_TABLE(cache, struct cache, CALCULATE_CACHE_HASH, index, hash);
283 struct cache *cache_init(int buffer_size, int max_buffers, int noshrink_lookup, in INSERT_LIST()
286 struct cache *cache = malloc(sizeof(struct cache)); in INSERT_LIST() local
288 if(cache == NULL) in INSERT_LIST()
291 cache->max_buffers = max_buffers; in INSERT_LIST()
292 cache->buffer_size = buffer_size; in INSERT_LIST()
293 cache->count = 0; in INSERT_LIST()
294 cache->used = 0; in INSERT_LIST()
295 cache->free_list = NULL; in INSERT_LIST()
[all …]
/external/XNNPACK/src/
Dcache.c87 static inline size_t cache_size(struct xnn_cache* cache) { in cache_size() argument
88 switch (cache->type) { in cache_size()
90 return cache->code.size; in cache_size()
92 return cache->weights.size; in cache_size()
100 static inline void* cache_start(struct xnn_cache* cache) { in cache_start() argument
101 switch (cache->type) { in cache_start()
103 return cache->code.start; in cache_start()
105 return cache->weights.start; in cache_start()
112 enum xnn_status xnn_init_cache_with_size(struct xnn_cache* cache, size_t num_buckets, enum xnn_cach… in xnn_init_cache_with_size() argument
114 memset(cache, 0, sizeof(struct xnn_cache)); in xnn_init_cache_with_size()
[all …]
/external/mesa3d/src/gallium/auxiliary/util/
Du_cache.c91 ensure_sanity(const struct util_cache *cache);
105 struct util_cache *cache; in util_cache_create() local
107 cache = CALLOC_STRUCT(util_cache); in util_cache_create()
108 if (!cache) in util_cache_create()
111 cache->hash = hash; in util_cache_create()
112 cache->compare = compare; in util_cache_create()
113 cache->destroy = destroy; in util_cache_create()
115 make_empty_list(&cache->lru); in util_cache_create()
118 cache->size = size; in util_cache_create()
120 cache->entries = CALLOC(size, sizeof(struct util_cache_entry)); in util_cache_create()
[all …]
/external/cronet/net/ssl/
Dssl_client_session_cache_unittest.cc80 SSLClientSessionCache cache(config); in TEST_F() local
86 EXPECT_EQ(nullptr, cache.Lookup(MakeTestKey("key1")).get()); in TEST_F()
87 EXPECT_EQ(nullptr, cache.Lookup(MakeTestKey("key2")).get()); in TEST_F()
88 EXPECT_EQ(0u, cache.size()); in TEST_F()
90 cache.Insert(MakeTestKey("key1"), bssl::UpRef(session1)); in TEST_F()
91 EXPECT_EQ(session1.get(), cache.Lookup(MakeTestKey("key1")).get()); in TEST_F()
92 EXPECT_EQ(nullptr, cache.Lookup(MakeTestKey("key2")).get()); in TEST_F()
93 EXPECT_EQ(1u, cache.size()); in TEST_F()
95 cache.Insert(MakeTestKey("key2"), bssl::UpRef(session2)); in TEST_F()
96 EXPECT_EQ(session1.get(), cache.Lookup(MakeTestKey("key1")).get()); in TEST_F()
[all …]
/external/freetype/src/cache/
Dftccache.c27 #define FT_COMPONENT cache
90 ftc_get_top_node_for_hash( FTC_Cache cache, in ftc_get_top_node_for_hash() argument
96 idx = hash & cache->mask; in ftc_get_top_node_for_hash()
97 if ( idx < cache->p ) in ftc_get_top_node_for_hash()
98 idx = hash & ( 2 * cache->mask + 1 ); in ftc_get_top_node_for_hash()
100 return cache->buckets + idx; in ftc_get_top_node_for_hash()
111 ftc_cache_resize( FTC_Cache cache ) in ftc_cache_resize() argument
116 FT_UFast p = cache->p; in ftc_cache_resize()
117 FT_UFast mask = cache->mask; in ftc_cache_resize()
122 if ( cache->slack < 0 ) in ftc_cache_resize()
[all …]
/external/mesa3d/src/compiler/glsl/tests/
Dcache_test.c151 does_cache_contain(struct disk_cache *cache, const cache_key key) in does_cache_contain() argument
155 result = disk_cache_get(cache, key, NULL); in does_cache_contain()
166 cache_exists(struct disk_cache *cache) in cache_exists() argument
171 if (!cache) in cache_exists()
174 disk_cache_put(cache, dummy_key, data, sizeof(data), NULL); in cache_exists()
175 disk_cache_wait_for_idle(cache); in cache_exists()
176 return disk_cache_get(cache, dummy_key, NULL); in cache_exists()
184 struct disk_cache *cache; in test_disk_cache_create() local
191 cache = disk_cache_create("test", "make_check", 0); in test_disk_cache_create()
192 expect_null(cache, "disk_cache_create with MESA_GLSL_CACHE_DISABLE set"); in test_disk_cache_create()
[all …]
/external/mesa3d/src/freedreno/vulkan/
Dtu_pipeline_cache.c48 tu_pipeline_cache_init(struct tu_pipeline_cache *cache, in tu_pipeline_cache_init() argument
51 cache->device = device; in tu_pipeline_cache_init()
52 pthread_mutex_init(&cache->mutex, NULL); in tu_pipeline_cache_init()
54 cache->modified = false; in tu_pipeline_cache_init()
55 cache->kernel_count = 0; in tu_pipeline_cache_init()
56 cache->total_size = 0; in tu_pipeline_cache_init()
57 cache->table_size = 1024; in tu_pipeline_cache_init()
58 const size_t byte_size = cache->table_size * sizeof(cache->hash_table[0]); in tu_pipeline_cache_init()
59 cache->hash_table = malloc(byte_size); in tu_pipeline_cache_init()
64 if (cache->hash_table == NULL) in tu_pipeline_cache_init()
[all …]
/external/mesa3d/src/amd/vulkan/
Dradv_pipeline_cache.c47 radv_pipeline_cache_lock(struct radv_pipeline_cache *cache) in radv_pipeline_cache_lock() argument
49 if (cache->flags & VK_PIPELINE_CACHE_CREATE_EXTERNALLY_SYNCHRONIZED_BIT_EXT) in radv_pipeline_cache_lock()
52 pthread_mutex_lock(&cache->mutex); in radv_pipeline_cache_lock()
56 radv_pipeline_cache_unlock(struct radv_pipeline_cache *cache) in radv_pipeline_cache_unlock() argument
58 if (cache->flags & VK_PIPELINE_CACHE_CREATE_EXTERNALLY_SYNCHRONIZED_BIT_EXT) in radv_pipeline_cache_unlock()
61 pthread_mutex_unlock(&cache->mutex); in radv_pipeline_cache_unlock()
65 radv_pipeline_cache_init(struct radv_pipeline_cache *cache, in radv_pipeline_cache_init() argument
68 cache->device = device; in radv_pipeline_cache_init()
69 pthread_mutex_init(&cache->mutex, NULL); in radv_pipeline_cache_init()
70 cache->flags = 0; in radv_pipeline_cache_init()
[all …]
/external/libwebsockets/lib/misc/cache-ttl/
Dheap.c33 update_sul(lws_cache_ttl_lru_t_heap_t *cache);
54 _lws_cache_heap_item_destroy(lws_cache_ttl_lru_t_heap_t *cache, in _lws_cache_heap_item_destroy() argument
57 lwsl_cache("%s: %s (%s)\n", __func__, cache->cache.info.name, in _lws_cache_heap_item_destroy()
63 cache->cache.current_footprint -= item->size; in _lws_cache_heap_item_destroy()
65 update_sul(cache); in _lws_cache_heap_item_destroy()
67 if (cache->cache.info.cb) in _lws_cache_heap_item_destroy()
68 cache->cache.info.cb((void *)((uint8_t *)&item[1]), item->size); in _lws_cache_heap_item_destroy()
74 lws_cache_heap_item_destroy(lws_cache_ttl_lru_t_heap_t *cache, in lws_cache_heap_item_destroy() argument
77 struct lws_cache_ttl_lru *backing = &cache->cache; in lws_cache_heap_item_destroy()
98 cache->items_lru.head) { in lws_cache_heap_item_destroy()
[all …]
/external/mesa3d/src/mesa/program/
Dprog_cache.c84 rehash(struct gl_program_cache *cache) in rehash() argument
90 cache->last = NULL; in rehash()
92 size = cache->size * 3; in rehash()
96 for (i = 0; i < cache->size; i++) in rehash()
97 for (c = cache->items[i]; c; c = next) { in rehash()
103 free(cache->items); in rehash()
104 cache->items = items; in rehash()
105 cache->size = size; in rehash()
110 clear_cache(struct gl_context *ctx, struct gl_program_cache *cache, in clear_cache() argument
116 cache->last = NULL; in clear_cache()
[all …]
/external/squashfs-tools/kernel/fs/squashfs/
Dcache.c67 struct squashfs_cache *cache, u64 block, int length) in squashfs_cache_get() argument
72 spin_lock(&cache->lock); in squashfs_cache_get()
75 for (i = 0; i < cache->entries; i++) in squashfs_cache_get()
76 if (cache->entry[i].block == block) in squashfs_cache_get()
79 if (i == cache->entries) { in squashfs_cache_get()
84 if (cache->unused == 0) { in squashfs_cache_get()
85 cache->num_waiters++; in squashfs_cache_get()
86 spin_unlock(&cache->lock); in squashfs_cache_get()
87 wait_event(cache->wait_queue, cache->unused); in squashfs_cache_get()
88 spin_lock(&cache->lock); in squashfs_cache_get()
[all …]
/external/mesa3d/src/mesa/drivers/dri/i965/
Dbrw_program_cache.c119 search_cache(struct brw_cache *cache, GLuint hash, in search_cache() argument
127 for (c = cache->items[hash % cache->size]; c; c = c->next) in search_cache()
130 fprintf(stderr, "bucket %d/%d = %d/%d items\n", hash % cache->size, in search_cache()
131 cache->size, bucketcount, cache->n_items); in search_cache()
134 for (c = cache->items[hash % cache->size]; c; c = c->next) { in search_cache()
144 rehash(struct brw_cache *cache) in rehash() argument
150 size = cache->size * 3; in rehash()
153 for (i = 0; i < cache->size; i++) in rehash()
154 for (c = cache->items[i]; c; c = next) { in rehash()
160 free(cache->items); in rehash()
[all …]
/external/cronet/net/http/
Dhttp_cache_unittest.cc177 explicit DeleteCacheCompletionCallback(std::unique_ptr<MockHttpCache> cache) in DeleteCacheCompletionCallback() argument
178 : cache_(std::move(cache)) {} in DeleteCacheCompletionCallback()
222 void RunTransactionTestBase(HttpCache* cache, in RunTransactionTestBase() argument
236 int rv = cache->CreateTransaction(DEFAULT_PRIORITY, &trans); in RunTransactionTestBase()
273 void RunTransactionTestWithRequest(HttpCache* cache, in RunTransactionTestWithRequest() argument
277 RunTransactionTestBase(cache, trans_info, request, response_info, in RunTransactionTestWithRequest()
282 void RunTransactionTestAndGetTiming(HttpCache* cache, in RunTransactionTestAndGetTiming() argument
286 RunTransactionTestBase(cache, trans_info, MockHttpRequest(trans_info), in RunTransactionTestAndGetTiming()
292 HttpCache* cache, in RunTransactionTestAndGetTimingAndConnectedSocketAddress() argument
297 RunTransactionTestBase(cache, trans_info, MockHttpRequest(trans_info), in RunTransactionTestAndGetTimingAndConnectedSocketAddress()
[all …]

12345678910>>...141