Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 20 for lruCache (0.17 sec)

  1. pilot/pkg/model/typed_xds_cache.go

    }
    
    type evictKeyConfigs[K comparable] struct {
    	key              K
    	dependentConfigs []ConfigHash
    }
    
    type lruCache[K comparable] struct {
    	enableAssertions bool
    	store            simplelru.LRUCache[K, cacheValue]
    	// token stores the latest token of the store, used to prevent stale data overwrite.
    	// It is refreshed when Clear or ClearAll are called
    	token       CacheToken
    	mu          sync.RWMutex
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Sat Mar 30 05:26:03 UTC 2024
    - 11K bytes
    - Viewed (0)
  2. plugin/pkg/admission/eventratelimit/cache.go

    func (c *singleCache) get(key interface{}) flowcontrol.RateLimiter {
    	return c.rateLimiter
    }
    
    // lruCache is a least-recently-used cache
    type lruCache struct {
    	// factory to use to create new rate limiters
    	rateLimiterFactory func() flowcontrol.RateLimiter
    	// the actual LRU cache
    	cache *lru.Cache
    }
    
    func (c *lruCache) get(key interface{}) flowcontrol.RateLimiter {
    	value, found := c.cache.Get(key)
    	if !found {
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Thu Jul 08 02:31:37 UTC 2021
    - 1.6K bytes
    - Viewed (0)
  3. pilot/pkg/model/typed_xds_cache_test.go

    			ConfigKey{Kind: kind.DestinationRule, Name: "name", Namespace: "namespace"}.HashCode(),
    		},
    	}
    
    	c := newTypedXdsCache[uint64]()
    
    	cache := c.(*lruCache[uint64])
    
    	assert.Equal(t, cache.store.Len(), 0)
    	assert.Equal(t, cache.indexLength(), 0)
    
    	// adding the entry populates the indexes
    	c.Add(firstEntry.Key(), firstEntry, req, res)
    
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Mon Jan 29 20:35:31 UTC 2024
    - 18.2K bytes
    - Viewed (0)
  4. pkg/kubelet/clustertrustbundle/clustertrustbundle_manager.go

    import (
    	"encoding/pem"
    	"fmt"
    	"math/rand"
    	"time"
    
    	certificatesv1alpha1 "k8s.io/api/certificates/v1alpha1"
    	k8serrors "k8s.io/apimachinery/pkg/api/errors"
    	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
    	lrucache "k8s.io/apimachinery/pkg/util/cache"
    	"k8s.io/apimachinery/pkg/util/sets"
    	certinformersv1alpha1 "k8s.io/client-go/informers/certificates/v1alpha1"
    	certlistersv1alpha1 "k8s.io/client-go/listers/certificates/v1alpha1"
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Fri Nov 03 18:40:48 UTC 2023
    - 8.3K bytes
    - Viewed (0)
  5. plugin/pkg/admission/eventratelimit/cache_test.go

    	}
    	nextRateLimiter := 0
    	rateLimiterFactory := func() flowcontrol.RateLimiter {
    		rateLimiter := rateLimiters[nextRateLimiter]
    		nextRateLimiter++
    		return rateLimiter
    	}
    	underlyingCache := lru.New(2)
    	cache := lruCache{
    		rateLimiterFactory: rateLimiterFactory,
    		cache:              underlyingCache,
    	}
    	cases := []struct {
    		name     string
    		key      int
    		expected flowcontrol.RateLimiter
    	}{
    		{
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Thu Jul 08 02:31:37 UTC 2021
    - 2.7K bytes
    - Viewed (0)
  6. plugin/pkg/admission/eventratelimit/limitenforcer.go

    			},
    			keyFunc: getServerKey,
    		}, nil
    	}
    
    	cacheSize := int(config.CacheSize)
    	if cacheSize == 0 {
    		cacheSize = defaultCacheSize
    	}
    	underlyingCache := lru.New(cacheSize)
    	cache := &lruCache{
    		rateLimiterFactory: rateLimiterFactory,
    		cache:              underlyingCache,
    	}
    
    	var keyFunc func(admission.Attributes) string
    	switch t := config.Type; t {
    	case eventratelimitapi.NamespaceLimitType:
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Thu Jul 08 02:31:37 UTC 2021
    - 3.8K bytes
    - Viewed (0)
  7. pkg/cache/ttlCache.go

    // ttlWrapper type makes it so we control the exposure of the underlying ttlCache pointer.
    // When the pointer to ttlWrapper is finalized, this tells us to go ahead and stop the
    // evicter goroutine, which allows the lruCache instance to be collected and everything
    // ends well.
    
    // See use of SetFinalizer below for an explanation of this weird composition
    type ttlWrapper struct {
    	*ttlCache
    }
    
    type ttlCache struct {
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Tue May 23 17:08:31 UTC 2023
    - 7.8K bytes
    - Viewed (0)
  8. docs_src/settings/app03_an_py39/main.py

    from functools import lru_cache
    
    from fastapi import Depends, FastAPI
    from typing_extensions import Annotated
    
    from . import config
    
    app = FastAPI()
    
    
    @lru_cache
    def get_settings():
        return config.Settings()
    
    
    @app.get("/info")
    async def info(settings: Annotated[config.Settings, Depends(get_settings)]):
        return {
            "app_name": settings.app_name,
            "admin_email": settings.admin_email,
    Registered: Mon Jun 17 08:32:26 UTC 2024
    - Last Modified: Tue Oct 24 20:26:06 UTC 2023
    - 462 bytes
    - Viewed (0)
  9. docs_src/settings/app03/main.py

    from functools import lru_cache
    
    from fastapi import Depends, FastAPI
    
    from . import config
    
    app = FastAPI()
    
    
    @lru_cache
    def get_settings():
        return config.Settings()
    
    
    @app.get("/info")
    async def info(settings: config.Settings = Depends(get_settings)):
        return {
            "app_name": settings.app_name,
            "admin_email": settings.admin_email,
            "items_per_user": settings.items_per_user,
    Registered: Mon Jun 17 08:32:26 UTC 2024
    - Last Modified: Tue Oct 24 20:26:06 UTC 2023
    - 412 bytes
    - Viewed (0)
  10. docs_src/settings/app02_an/main.py

    from functools import lru_cache
    
    from fastapi import Depends, FastAPI
    from typing_extensions import Annotated
    
    from .config import Settings
    
    app = FastAPI()
    
    
    @lru_cache
    def get_settings():
        return Settings()
    
    
    @app.get("/info")
    async def info(settings: Annotated[Settings, Depends(get_settings)]):
        return {
            "app_name": settings.app_name,
            "admin_email": settings.admin_email,
    Registered: Mon Jun 17 08:32:26 UTC 2024
    - Last Modified: Tue Oct 24 20:26:06 UTC 2023
    - 456 bytes
    - Viewed (0)
Back to top