@@ -19,7 +19,7 @@ type InMemoryCache struct {
1919
2020// NewCache constructs a new InMemoryCache
2121func NewCache () * InMemoryCache {
22- items := make (map [interface {} ]Thunk )
22+ items := make (map [string ]Thunk )
2323 return & InMemoryCache {
2424 items : items ,
2525 }
@@ -28,7 +28,7 @@ func NewCache() *InMemoryCache {
2828// Set sets the `value` at `key` in the cache
2929func (c * InMemoryCache ) Set (_ context.Context , key Key , value Thunk ) {
3030 c .mu .Lock ()
31- c .items [key .Key ()] = value
31+ c .items [key .String ()] = value
3232 c .mu .Unlock ()
3333}
3434
@@ -38,7 +38,7 @@ func (c *InMemoryCache) Get(_ context.Context, key Key) (Thunk, bool) {
3838 c .mu .RLock ()
3939 defer c .mu .RUnlock ()
4040
41- item , found := c .items [key .Key ()]
41+ item , found := c .items [key .String ()]
4242 if ! found {
4343 return nil , false
4444 }
@@ -47,11 +47,11 @@ func (c *InMemoryCache) Get(_ context.Context, key Key) (Thunk, bool) {
4747}
4848
4949// Delete deletes item at `key` from cache
50- func (c * InMemoryCache ) Delete (ctx context.Context , key interface {} ) bool {
50+ func (c * InMemoryCache ) Delete (ctx context.Context , key Key ) bool {
5151 if _ , found := c .Get (ctx , key ); found {
5252 c .mu .Lock ()
5353 defer c .mu .Unlock ()
54- delete (c .items , key .Key ())
54+ delete (c .items , key .String ())
5555 return true
5656 }
5757 return false
0 commit comments