Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 40 for LRU (0.01 sec)

  1. internal/lru/lru.go

    package lru
    
    // golang -lru
    // https://github.com/hashicorp/golang-lru
    import (
    	"sync"
    	"time"
    )
    
    // EvictCallback is used to get a callback when a cache entry is evicted
    type EvictCallback[K comparable, V any] func(key K, value V)
    
    // LRU implements a thread-safe LRU with expirable entries.
    type LRU[K comparable, V any] struct {
    	size      int
    	evictList *LruList[K, V]
    	items     map[K]*Entry[K, V]
    	onEvict   EvictCallback[K, V]
    Registered: Sun Dec 28 09:35:17 UTC 2025
    - Last Modified: Fri Apr 25 08:22:26 UTC 2025
    - 12.5K bytes
    - Viewed (0)
  2. tests/lru_test.go

    	lru := lru.NewLRU[string, int](10, nil, time.Hour)
    	lru.Add("key1", 1)
    
    	if value, ok := lru.Get("key1"); !ok || value != 1 {
    		t.Errorf("Expected key1 to be added with value 1, got %v", value)
    	}
    }
    
    func TestLRU_Add_ExceedsSize_RemovesOldest(t *testing.T) {
    	lru := lru.NewLRU[string, int](2, nil, time.Hour)
    	lru.Add("key1", 1)
    	lru.Add("key2", 2)
    	lru.Add("key3", 3)
    
    	if _, ok := lru.Get("key1"); ok {
    Registered: Sun Dec 28 09:35:17 UTC 2025
    - Last Modified: Mon Sep 08 09:19:22 UTC 2025
    - 10.4K bytes
    - Viewed (0)
  3. internal/stmt_store/stmt_store.go

    	lru *lru.LRU[string, *Stmt]
    }
    
    func (s *lruStore) Keys() []string {
    	return s.lru.Keys()
    }
    
    func (s *lruStore) Get(key string) (*Stmt, bool) {
    	stmt, ok := s.lru.Get(key)
    	if ok && stmt != nil {
    		<-stmt.prepared
    	}
    	return stmt, ok
    }
    
    func (s *lruStore) Set(key string, value *Stmt) {
    	s.lru.Add(key, value)
    }
    
    func (s *lruStore) Delete(key string) {
    	s.lru.Remove(key)
    }
    Registered: Sun Dec 28 09:35:17 UTC 2025
    - Last Modified: Sun Apr 27 06:05:16 UTC 2025
    - 6K bytes
    - Viewed (0)
  4. src/test/java/org/codelibs/core/collection/LruHashMapTest.java

         */
        @Test
        public void testAll() throws Exception {
            final LruHashMap<String, String> lru = new LruHashMap<String, String>(3);
            lru.put("aaa", "111");
            lru.put("bbb", "222");
            lru.put("ccc", "333");
            assertThat(lru.get("aaa"), is("111"));
            Iterator<String> i = lru.keySet().iterator();
            assertThat(i.next(), is("bbb"));
            assertThat(i.next(), is("ccc"));
    Registered: Sat Dec 20 08:55:33 UTC 2025
    - Last Modified: Sat May 10 01:32:17 UTC 2025
    - 1.7K bytes
    - Viewed (0)
  5. src/main/java/org/codelibs/core/collection/LruHashMap.java

    import java.util.HashMap;
    import java.util.LinkedHashMap;
    import java.util.Map;
    
    /**
     * {@link HashMap} with an upper limit on the number of entries. When a new entry is added, the oldest entry is discarded using LRU if the limit is exceeded.
     * <p>
     * <strong>Thread-Safety:</strong> This class is <strong>NOT thread-safe</strong>.
     * It extends {@link LinkedHashMap} without synchronization. If multiple threads access
    Registered: Sat Dec 20 08:55:33 UTC 2025
    - Last Modified: Sat Nov 22 11:21:59 UTC 2025
    - 3K bytes
    - Viewed (0)
  6. android/guava/src/com/google/thirdparty/publicsuffix/PublicSuffixPatterns.java

    vt?w!.&66duolc,gro?moc?s&ndnyd,tepym,?ten?ude?vog??a!.&no.&1-&ht&ron-ue.&lru-adbmal,ppabew-refsnart,?uos-&em.&lru-adbmal,ppabew-refsnart,?fa.&lru-adbmal,ppabew-refsnart,?pa.&lru-adbmal,ppabew-refsnart,?ue.&lru-adbmal,ppabew-refsnart,???lartnec-&ac.&lru-adbmal,ppabew-refsnart,?em.ppabew-refsnart,li.ppabew-refsnart,ue.&lru-adbmal,ppabew-refsnart,??ts&ae&-&as.&lru-adbmal,ppabew-refsnart,?pa.&lru-adbmal,ppabew-refsnart,?su.&lru-adbmal,ppabew-refsnart,?vog-su.&ppabew-refsnart,spif-ppabew-refsnart,??h...
    Registered: Fri Dec 26 12:43:10 UTC 2025
    - Last Modified: Tue Dec 16 20:00:28 UTC 2025
    - 76.5K bytes
    - Viewed (1)
  7. tests/prepared_stmt_test.go

    	lens := len(conn.Stmts.Keys())
    	// Check if the number of stored statement keys is 0.
    	if lens == 0 {
    		// If the number is 0, it means there are no statements stored in the LRU cache.
    		// The test fails and an error message is output.
    		t.Fatalf("lru should not be empty")
    	}
    	// Wait for 40 seconds to give the statements in the cache enough time to expire.
    	time.Sleep(time.Second * 40)
    Registered: Sun Dec 28 09:35:17 UTC 2025
    - Last Modified: Fri Apr 25 08:22:26 UTC 2025
    - 8K bytes
    - Viewed (0)
  8. android/guava-tests/test/com/google/common/cache/CacheEvictionTest.java

                Integer key = entry.getKey();
                cache.invalidate(key);
              }
            });
      }
    
      public void testEviction_lru() {
        // test lru within a single segment
        IdentityLoader<Integer> loader = identityLoader();
        LoadingCache<Integer, Integer> cache =
            CacheBuilder.newBuilder().concurrencyLevel(1).maximumSize(10).build(loader);
    Registered: Fri Dec 26 12:43:10 UTC 2025
    - Last Modified: Tue Oct 28 18:19:59 UTC 2025
    - 15.1K bytes
    - Viewed (0)
  9. docs/ru/docs/advanced/settings.md

    ### Создание `Settings` только один раз с помощью `lru_cache` { #creating-the-settings-only-once-with-lru-cache }
    
    Чтение файла с диска обычно затратная (медленная) операция, поэтому, вероятно, вы захотите сделать это один раз и затем переиспользовать один и тот же объект настроек, а не читать файл при каждом запросе.
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 18.3K bytes
    - Viewed (0)
  10. src/main/java/org/codelibs/core/collection/LruHashSet.java

     */
    public class LruHashSet<E> extends AbstractSet<E> implements Set<E>, java.io.Serializable {
        private static final long serialVersionUID = 1L;
    
        /**
         * The internal LRU hash map used to store elements.
         */
        private final LruHashMap<E, Object> map;
    
        // Dummy value to associate with an Object in the backing Map
        private static final Object PRESENT = new Object();
    
        /**
    Registered: Sat Dec 20 08:55:33 UTC 2025
    - Last Modified: Sat Jul 05 00:11:05 UTC 2025
    - 3.7K bytes
    - Viewed (0)
Back to top