Пример #1
0
// NewIdentify2Cache creates a Identify2Cache and sets the object max age to
// maxAge.  Once a user is inserted, after maxAge duration passes,
// the user will be removed from the cache.
func NewIdentify2Cache(maxAge time.Duration) *Identify2Cache {
	res := &Identify2Cache{
		cache: ramcache.New(),
	}
	res.cache.MaxAge = maxAge
	res.cache.TTL = maxAge
	return res
}
Пример #2
0
func NewTrackCache() *TrackCache {
	res := &TrackCache{
		cache: ramcache.New(),
	}
	res.cache.TTL = 10 * time.Minute
	res.cache.MaxAge = 10 * time.Minute
	return res
}
Пример #3
0
func NewIdentifyCache() *IdentifyCache {
	res := &IdentifyCache{
		cache: ramcache.New(),
	}
	res.cache.TTL = 10 * time.Minute
	res.cache.MaxAge = 10 * time.Minute
	return res
}
Пример #4
0
// NewUserCache creates a UserCache and sets the object max age to
// maxAge.  Once a user is inserted, after maxAge duration passes,
// the user will be removed from the cache.
func NewUserCache(maxAge time.Duration) *UserCache {
	res := &UserCache{
		cache: ramcache.New(),
	}
	res.cache.MaxAge = maxAge
	res.cache.TTL = maxAge
	return res
}
Пример #5
0
func NewIdentifyHandler(xp rpc.Transporter, g *libkb.GlobalContext) *IdentifyHandler {
	c := ramcache.New()
	c.TTL = 5 * time.Minute
	c.MaxAge = 5 * time.Minute

	return &IdentifyHandler{
		BaseHandler:  NewBaseHandler(xp),
		Contextified: libkb.NewContextified(g),
		resultCache:  c,
	}
}
Пример #6
0
func (r *Resolver) EnableCaching() {
	cache := ramcache.New()
	cache.MaxAge = resolveCacheMaxAge
	cache.TTL = resolveCacheTTL
	r.cache = cache
}