示例#1
0
文件: zset.go 项目: Skycrab/go-zset
func (z *zset) Rem(member string) {
	if score, ok := z.tbl[member]; ok {
		var obj C.slobj
		obj.ptr, obj.length = tocstring(member)
		C.slDelete(z.sl, C.double(score), &obj)
		delete(z.tbl, member)
	}
}
示例#2
0
文件: zset.go 项目: Skycrab/go-zset
func (z *zset) Add(score float64, member string) {
	if old, ok := z.tbl[member]; ok {
		if old == score {
			return
		}
		var obj C.slobj
		obj.ptr, obj.length = tocstring(member)
		C.slDelete(z.sl, C.double(old), &obj)
	}
	C.slInsert(z.sl, C.double(score), newslobj(member))
	z.tbl[member] = score
}