From ebb2dc540858155152b21549afd77e65118e1474 Mon Sep 17 00:00:00 2001 From: Marc Pervaz Boocha Date: Tue, 8 Apr 2025 16:15:27 +0530 Subject: Lint and bug fixes --- README.md | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'README.md') diff --git a/README.md b/README.md index f4dba3a..6d0054c 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,13 @@ # Cache +An deamonless in-memory caching library with persistant snapshots. + ## Features - **In-Memory Cache**: Fast access to cached data. - **Uses Generics with serialization**: To make it type safe and support several types via msgpack. -s + - **File-Backed Storage**: Persistent storage of cache data. - **Eviction Policies**: Support for FIFO, LRU, LFU, and LTR eviction policies. @@ -86,13 +88,21 @@ func main() { } // Get a value by key - value, ttl, err := db.GetValue("key") if err != nil { log.Fatal(err) } fmt.Printf("Value: %s, TTL: %v\n", value, ttl) + + // Get a value with a pointer by key(Useful if the value type is an interface). + var value string + value, ttl, err := db.GetValue(&value) + if err != nil { + log.Fatal(err) + } + + fmt.Printf("Value: %s, TTL: %v\n", value, ttl) } ``` @@ -128,7 +138,7 @@ The Cache Library supports the following configuration options: ### Additional Methods -- `Get`: Retrieves a value from the cache by key and returns its TTL. +- `Get`: Retrieves a value from the cache by key and returns its TTL. It take an out pointer. - `GetValue`: Retrieves a value from the cache by key and returns the value and its TTL. -- cgit v1.2.3-70-g09d2