A generic key value storage interface. The storage may be persistent (e.g., a database) or volatile (e.g., cache). All Storage implementations must be thread safe.
| 5 | // (e.g., a database) or volatile (e.g., cache). All Storage implementations |
| 6 | // must be thread safe. |
| 7 | type Storage interface { |
| 8 | // This retrieves a single value from the storage. |
| 9 | Get(key interface{}) (interface{}, error) |
| 10 | |
| 11 | // This retrieves multiple values from the storage. The items are returned |
| 12 | // in the same order as the input keys. |
| 13 | GetMulti(keys ...interface{}) ([]interface{}, error) |
| 14 | |
| 15 | // This stores a single item into the storage. |
| 16 | Set(item interface{}) error |
| 17 | |
| 18 | // This stores multiple items into the storage. |
| 19 | SetMulti(items ...interface{}) error |
| 20 | |
| 21 | // This removes a single item from the storage. |
| 22 | Delete(key interface{}) error |
| 23 | |
| 24 | // This removes multiple items from the storage. |
| 25 | DeleteMulti(keys ...interface{}) error |
| 26 | |
| 27 | // This wipes all items from the storage. |
| 28 | Flush() error |
| 29 | } |
| 30 | |
| 31 | type ToStringFunc (func(key interface{}) string) |
no outgoing calls
no test coverage detected