Пример #1
0
func (peer *testPeer) Get(group, key string) (*rs.Resource, error) {

	response := rs.New([]byte(key))
	peer.hitCnt++

	return response, nil
}
Пример #2
0
func (c *cache) set(key string, value []byte) *rs.Resource {

	c.lock.Lock()
	defer c.lock.Unlock()

	res := rs.New(value)
	c.lru.Set(key, res)
	c.nBytes += uint64(len(key) + len(value))
	return res
}