// Put sets the value for a key.
168600
func (kv *KV) Put(key, value []byte) error {
	_, err := kv.db.Exec(
		fmt.Sprintf("REPLACE INTO %s(id, k, v) VALUES (?,?,?)", string(kv.table)),
		kv.id(key), gkv.Btos(key), gkv.Btos(value),
	)
	return err
}
100749
func (batch *UpdateBatch) Put(ns string, key string, value []byte, version *version.Height) {
	batch.PutValAndMetadata(ns, key, value, nil, version)
}
474568
func (c *Cache) Put(ctx context.Context, key storage.CacheKey, val []byte, exp time.Duration) {
	c.mu.Lock()
	defer c.mu.Unlock()

	if c.cacheMap == nil {
		c.cacheMap = make(map[storage.CacheKey][]byte)
	}

	c.cacheMap[key] = val
}
424077
func (m *MultiMap) Put(key interface{}, value interface{}) {
	m.m[key] = append(m.m[key], value)
}
132359
func (d *NullDatastore) Put(key Key, value []byte) (err error) {
	return nil
}
847825
func (tx *Tx) Put(key []byte, value []byte) error {
	if tx.cellar == nil {
		return ErrTxClosed
	} else if !tx.writable {
		return ErrTxNotWritable
	}
	return tx.segmentBuilder.Put(key, value)
}
195755
func (ht *HashTable) Put(key, val int) {
	for bucket, entry := ht.HashKey(key), 0; ; {
		entryAddr := bucket*ht.BucketSize + BucketHeader + entry*EntrySize
		if ht.Buf[entryAddr] != 1 {
			ht.Buf[entryAddr] = 1
			binary.PutVarint(ht.Buf[entryAddr+1:entryAddr+11], int64(key))
			binary.PutVarint(ht.Buf[entryAddr+11:entryAddr+21], int64(val))
			return
		}
		if entry++; entry == ht.PerBucket {
			entry = 0
			if bucket = ht.nextBucket(bucket); bucket == 0 {
				ht.growBucket(ht.HashKey(key))
				ht.Put(key, val)
				return
			}
		}
	}
}
640945
func (s *MemoryStore) Put(key string, value interface{}) error {
	s.mu.Lock()
	defer s.mu.Unlock()
	if s.data == nil {
		s.data = map[string]string{}
	}

	buf, err := json.Marshal(value)
	if err != nil {
		return err
	}
	s.data[key] = string(buf)
	return nil
}
483476
func (kv *KV) Put(key, value []byte) error {
	return kv.db.Write(gkv.Btos(key), value)
}
843096
func (k *KV) Put(p *KVPair, q *WriteOptions) (*WriteMeta, error) {
	params := make(map[string]string, 1)
	if p.Flags != 0 {
		params["flags"] = strconv.FormatUint(p.Flags, 10)
	}
	_, wm, err := k.put(p.Key, params, p.Value, q)
	return wm, err
}
26659
func (ng *memAutoCertCache) Put(ctx context.Context, key string, data []byte) error {
	ng.mtx.Lock()
	defer ng.mtx.Unlock()
	ng.kv[key] = data
	return nil
}
264859
func (db *Database) Put(key []byte, value []byte) error {
	db.lock.Lock()
	defer db.lock.Unlock()

	if db.db == nil {
		return errMemorydbClosed
	}
	db.db[string(key)] = common.CopyBytes(value)
	return nil
}
544690
func (s *Session) Put(ctx context.Context, key string, val interface{}) {
	sd := s.getSessionDataFromContext(ctx)

	sd.mu.Lock()
	sd.Values[key] = val
	sd.status = Modified
	sd.mu.Unlock()
}
1073308
func (t *table) Put(key []byte, value []byte) error {
	return t.db.Put(append([]byte(t.prefix), key...), value)
}
709373
func (p *Plugin) Put(key string, data proto.Message, opts ...datasync.PutOption) error {
	if !p.isKvEnabled() {
		return nil
	}

	if p.adapter != nil {
		return p.adapter.db.Put(key, data, opts...)
	}

	return ErrNotReady
}
383900
func (m *Mercury) Put(ctx context.Context, key, val string, opts ...clientv3.OpOption) (*clientv3.PutResponse, error) {
	return m.cliv3.Put(ctx, m.parseKey(key), val, opts...)
}
131658
func (c *NodbCacher) Put(key string, val interface{}, expire int64) (err error) {
	var v []byte
	switch val.(type) {
	case []byte:
		v = val.([]byte)
	default:
		v = []byte(com.ToStr(val))
	}

	if err = c.db.Set([]byte(key), v); err != nil {
		return err
	}

	if expire > 0 {
		_, err = c.db.Expire([]byte(key), expire)
		return err
	}
	return nil
}