示例#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
}