Make common cache typed with generics (#2896)

Making typed common cache so that we don't use wrong types
across set/get methods and more higher-level methods can be
defined for cache.
Currently, we are not able to operate over all keys of the cache
due to generic types.
I also removed code comments around the cache.

Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>
This commit is contained in:
Sanket Sudake
2024-01-04 10:46:32 +05:30
committed by GitHub
parent 12f8017d9b
commit 0c8573467b
8 changed files with 105 additions and 145 deletions
+1 -1
View File
@@ -29,7 +29,7 @@ func checkErr(err error) {
}
func TestCache(t *testing.T) {
c := MakeCache(100*time.Millisecond, 100*time.Millisecond)
c := MakeCache[string, string](100*time.Millisecond, 100*time.Millisecond)
_, err := c.Set("a", "b")
checkErr(err)