We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hi.
For example:
set("username:victoria", "value") set("username:metrics", "value") ... scan("username:*", 10) // last 10
Is it possible to add this much-needed feature?
If not, please advise how to iterate the data without losing high speed and quality Fastcache?
Create a slice (like an index) with bucket indexes or keys or xxhashes, iterate all elements of the slice and Get values?
Thanks
The text was updated successfully, but these errors were encountered:
Ok, i write this solution:
type collection struct { Name string Keys []string } type cache struct { buckets [bucketCount]bucket collections []collection } c.collections = make([]collection, 0) // in New() func (c *cache) Collection(name string) { coll := &collection{ Name: name, Keys: make([]string, 0), } c.collections = append(c.collections, *coll) } func (c *cache) Set(collection string, k string, v []byte) error { var j int for index, coll := range c.collections { if coll.Name == collection { j = index } } c.collections[j].Keys = append(c.collections[j].Keys, k) h := xxhash.Sum64([]byte(k)) idx := h % bucketCount return c.buckets[i].Set([]byte(k), v, h) } func (c *cache) Group(collection string, count uint) ([]string, error) { var ( g []string j int ) for index, coll := range c.collections { if coll.Name == collection { j = index } } for _, k := range c.collections[j].Keys[:count] { v, e := c.Get(k) if e != nil { return nil, e } g = append(g, string(v)) } return g, nil }
Will this approach slow down the caching a lot?
Sorry, something went wrong.
No branches or pull requests
Hi.
For example:
Is it possible to add this much-needed feature?
If not, please advise how to iterate the data without losing high speed and quality Fastcache?
Create a slice (like an index) with bucket indexes or keys or xxhashes, iterate all elements of the slice and Get values?
Thanks
The text was updated successfully, but these errors were encountered: