coocood/freecache

[Question] Is the api cache.Del(key) assured to have no error?

ziranl16 opened this issue · 1 comments

Hi guys, thanks for the great project!

I have a little question about the delete key api in the project. From the usage as shown below

cache.Set(key, val, expire)
got, err := cache.Get(key)
if err != nil {
    fmt.Println(err)
} else {
    fmt.Printf("%s\n", got)
}
affected := cache.Del(key)

I noticed that does it mean errors might occur when setting the cache, but it is assured that the key will always be successfully deleted when we call cache.Del(key)

As I am using cache-aside pattern in my own project, so this info really helps. Because if cache.Del(key) is assured to succeed, I shall delete the cache keys after DB update to maintain data consistency : )

So sorry for the spam, I just noticed that it will return a boolean value to indicate if the key is deleted successfully