diff --git a/src/cached.cr b/src/cached.cr index 8c46656..ad1f6c1 100644 --- a/src/cached.cr +++ b/src/cached.cr @@ -44,8 +44,12 @@ class DODB::CachedDataBase(V) < DODB::Storage(V) # FIXME: rescues any error the same way. return nil end + + # WARNING: data isn't cloned. + # You have to do it yourself in case you modify any value, + # otherwise you may encounter problems (at least with indexes). def [](key : Int32) : V - @data[key].clone rescue raise MissingEntry.new(key) + @data[key] rescue raise MissingEntry.new(key) end def []=(index : Int32, value : V)