Exemplo n.º 1
0
func (c *memcacheCacher) doInvalidate(sessId string) error {
	return mc.Set(&memcache.Item{
		Key:        sessId,
		Value:      []byte(invalidPlaceholder),
		Expiration: invalidateTimeout,
	})
}
Exemplo n.º 2
0
func (c *memcacheCacher) doStore(u *User) error {
	ttl := int32(0)
	if !u.ExpiryTs.IsZero() {
		ttl = int32(u.ExpiryTs.Sub(time.Now()).Seconds())
	}
	return mc.Set(&memcache.Item{
		Key:        u.SessId,
		Value:      u.Token,
		Expiration: ttl,
	})
}