Cache: add method to get a copy of the map

This commit is contained in:
Soam Vasani
2016-11-04 23:05:29 -07:00
parent a000d4cc32
commit d805928f3e
2 changed files with 28 additions and 3 deletions
+7
View File
@@ -31,6 +31,8 @@ func TestCache(t *testing.T) {
err := c.Set("a", "b")
checkErr(err)
err = c.Set("p", "q")
checkErr(err)
val, err := c.Get("a")
checkErr(err)
@@ -38,6 +40,11 @@ func TestCache(t *testing.T) {
log.Panicf("value %v", val)
}
cc := c.Copy()
if len(cc) != 2 {
log.Panicf("expected 2 items")
}
err = c.Delete("a")
checkErr(err)