Example #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)
}
Example #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)
}
Example #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("")
}
Example #4
0
func (db *DB) HashLen(key []byte) *skv.Reply {
	return db.RawGet(skv.HashNsLengthKey(key))
}