Пример #1
0
func (db *DB) HashPut(key, field, value []byte, ttl int64) *skv.Reply {

	bkey := skv.HashNsEntryKey(key, field)

	if rs := db.RawGet(bkey); rs.Status == skv.ReplyNotFound {
		db.RawIncrby(skv.HashNsLengthKey(key), 1)
	}

	return db.RawPut(bkey, value, 0)
}
Пример #2
0
func (db *DB) HashPutJson(key, field []byte, value interface{}, ttl int64) *skv.Reply {

	bkey := skv.HashNsEntryKey(key, field)

	if rs := db.RawGet(bkey); rs.Status == skv.ReplyNotFound {
		db.RawIncrby(skv.HashNsLengthKey(key), 1)
	}

	return db._raw_put_json(bkey, value, 0)
}
Пример #3
0
func (db *DB) HashDel(key, field []byte) *skv.Reply {

	bkey := skv.HashNsEntryKey(key, field)

	if rs := db.RawGet(bkey); rs.Status == skv.ReplyOK {
		db.RawIncrby(skv.HashNsLengthKey(key), -1)
		return db.RawDel(bkey)
	}

	return skv.NewReply("")
}
Пример #4
0
func (db *DB) HashGet(key, field []byte) *skv.Reply {
	return db.RawGet(skv.HashNsEntryKey(key, field))
}