// Stores value with the given key and the given ttl in the cache. // // Do not use this method for storing big values in the cache such as video // files - use Cache.NewSetTxn() instead. func (cache *Cache) Set(key []byte, value []byte, ttl time.Duration) error { cache.dg.CheckLive() k := newKey(key) v := newValue(value, ttl) if C.ybc_item_set(cache.ctx(), &k, &v) == 0 { return ErrNoSpace } return nil }
// Stores value with the given key and the given ttl in the cache. // // Do not use this method for storing big values in the cache such as video // files - use Cache.NewSetTxn() instead. func (cache *Cache) Set(key []byte, value []byte, ttl time.Duration) error { cache.dg.CheckLive() var k C.struct_ybc_key initKey(&k, key) var v C.struct_ybc_value initValue(&v, value, ttl) if C.ybc_item_set(cache.ctx(), &k, &v) == 0 { return ErrNoSpace } return nil }