Package playn.core
Interface Storage
public interface Storage
Stores settings in a key/value map. This will attempt to store persistently, but will fall back
to an in-memory map. Use
isPersisted()
to check if the data are being persisted.-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic interface
Represents a batch of edits to be applied to storage in one transaction. -
Method Summary
Modifier and TypeMethodDescriptionReturns the item associated withkey
, or null if no item is associated with it.boolean
Returns true if storage data will be persistent across restarts.keys()
Returns an object that can be used to iterate over all storage keys.void
removeItem
(String key) Removes the item in the Storage associated with the specified key.void
Sets the value associated with the specified key todata
.Creates aStorage.Batch
that can be used to effect multiple changes to storage in a single, more efficient, operation.
-
Method Details
-
setItem
Sets the value associated with the specified key todata
.- Parameters:
key
- identifies the value.data
- the value associated with the key, which must not be null.
-
removeItem
Removes the item in the Storage associated with the specified key.- Parameters:
key
- identifies the value.
-
getItem
Returns the item associated withkey
, or null if no item is associated with it.- Parameters:
key
- identifies the value.- Returns:
- the value associated with the given key, or null.
-
startBatch
Storage.Batch startBatch()Creates aStorage.Batch
that can be used to effect multiple changes to storage in a single, more efficient, operation. -
keys
Returns an object that can be used to iterate over all storage keys. Note: changes made to storage while iterating over the keys will not be reflected in the iteration, nor will they conflict with it. -
isPersisted
boolean isPersisted()Returns true if storage data will be persistent across restarts.
-