Don't clone data by default. User can clone only when relevant.
parent
345390f4db
commit
bb6d9a26f7
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue