|
Sync Android SDK
2.0.2
|
SyncMap is a key-value store with Strings as keys and arbitrary JSON objects as values. More...
Classes | |
| interface | Item |
| Single item in a SyncMap. More... | |
| interface | QueryOptions |
| Options passed while querying SyncMap objects within Sync specifying query parameters and result set position and sorting. More... | |
| enum | QueryOrder |
| Defines collection query direction (forward or backwards item listing) More... | |
Public Member Functions | |
| String | getSid () |
| Retrieves a machine-generated unique identifier for this SyncMap. More... | |
| String | getUniqueName () |
| Retrieves a user-set unique name for this SyncMap. More... | |
| Date | getDateUpdated () |
| Retrieves a Date when the Map was last updated. More... | |
| void | getItem (String itemKey, SuccessListener< Item > listener) |
| Retrieve Item from the SyncMap. More... | |
| void | setItem (String itemKey, JSONObject itemData, SuccessListener< Item > listener) |
| Set Item in the SyncMap. More... | |
| void | setItem (String itemKey, JSONObject itemData, Item.Metadata metadata, SuccessListener< Item > listener) |
| Set Item in the SyncMap. More... | |
| void | mutateItem (String itemKey, SyncMutator mutator, SuccessListener< Item > listener) |
| Mutate Item in the SyncMap. More... | |
| void | mutateItem (String itemKey, SyncMutator mutator, Item.Metadata metadata, SuccessListener< Item > listener) |
| Mutate Item in the SyncMap. More... | |
| void | setTtl (int ttl, SuccessListener< Void > listener) |
| Set time to live for map object in seconds. More... | |
| void | setItemTtl (String itemKey, int ttl, SuccessListener< Void > listener) |
| Set time to live for an item in list. More... | |
| void | removeItem (String itemKey, SuccessListener< Void > listener) |
| Remove Item from the SyncMap. More... | |
| void | getItems (SuccessListener< SyncMapIterator > listener) |
| Get iterator access to all items in the map. More... | |
| QueryOptions | queryOptions () |
| Provide options for querying items from the SyncMap. More... | |
| void | queryItems (QueryOptions options, SuccessListener< SyncMapPaginator > listener) |
| Query paginated sequence of items from the map, based on query options. More... | |
| void | removeMap (SuccessListener< Void > listener) |
| Remove entire SyncMap object. More... | |
Public Attributes | |
| int | INFINITE_DURATION = 0 |
| Time to live for a map, specifying no expiry. | |
SyncMap is a key-value store with Strings as keys and arbitrary JSON objects as values.
You can add, remove and modify values associated with the keys.
To obtain an instance of a SyncMap use SyncClient#openMap.
| Date com.twilio.sync.SyncMap.getDateUpdated | ( | ) |
Retrieves a Date when the Map was last updated.
| void com.twilio.sync.SyncMap.getItem | ( | String | itemKey, |
| SuccessListener< Item > | listener | ||
| ) |
Retrieve Item from the SyncMap.
| itemKey | Key of the item to retrieve. |
| listener | Async result listener. See SuccessListener. |
| void com.twilio.sync.SyncMap.getItems | ( | SuccessListener< SyncMapIterator > | listener | ) |
Get iterator access to all items in the map.
| listener | Async result listener. See SuccessListener. |
| String com.twilio.sync.SyncMap.getSid | ( | ) |
Retrieves a machine-generated unique identifier for this SyncMap.
| String com.twilio.sync.SyncMap.getUniqueName | ( | ) |
Retrieves a user-set unique name for this SyncMap.
| void com.twilio.sync.SyncMap.mutateItem | ( | String | itemKey, |
| SyncMutator | mutator, | ||
| SuccessListener< Item > | listener | ||
| ) |
Uses default metadata.
| itemKey | Key of the item to mutate. |
| mutator | Mutator function object. |
| listener | Async result listener. See SuccessListener. |
| void com.twilio.sync.SyncMap.mutateItem | ( | String | itemKey, |
| SyncMutator | mutator, | ||
| Item.Metadata | metadata, | ||
| SuccessListener< Item > | listener | ||
| ) |
| itemKey | Key of the item to mutate. |
| mutator | Mutator function object. |
| metadata | Optional metadata for the set item, currently only ttl. |
| listener | Async result listener. See SuccessListener. |
| void com.twilio.sync.SyncMap.queryItems | ( | QueryOptions | options, |
| SuccessListener< SyncMapPaginator > | listener | ||
| ) |
Query paginated sequence of items from the map, based on query options.
The order of items within the page is not guaranteed.
| options | Specific query options. |
| listener | Async result listener. See SuccessListener. |
| QueryOptions com.twilio.sync.SyncMap.queryOptions | ( | ) |
Provide options for querying items from the SyncMap.
| void com.twilio.sync.SyncMap.removeItem | ( | String | itemKey, |
| SuccessListener< Void > | listener | ||
| ) |
| itemKey | Key of the item to remove. |
| listener | Async result listener. See SuccessListener. |
| void com.twilio.sync.SyncMap.removeMap | ( | SuccessListener< Void > | listener | ) |
Remove entire SyncMap object.
| listener | Async result listener. See SuccessListener. |
| void com.twilio.sync.SyncMap.setItem | ( | String | itemKey, |
| JSONObject | itemData, | ||
| SuccessListener< Item > | listener | ||
| ) |
Uses default metadata.
| itemKey | Key of the item to set. |
| itemData | Item data to set as a JSON object. |
| listener | Async result listener. See SuccessListener. |
| void com.twilio.sync.SyncMap.setItem | ( | String | itemKey, |
| JSONObject | itemData, | ||
| Item.Metadata | metadata, | ||
| SuccessListener< Item > | listener | ||
| ) |
| itemKey | Key of the item to set. |
| itemData | Item data to set as a JSON object. |
| metadata | Optional metadata for the set item, currently only ttl. |
| listener | Async result listener. See SuccessListener. |
| void com.twilio.sync.SyncMap.setItemTtl | ( | String | itemKey, |
| int | ttl, | ||
| SuccessListener< Void > | listener | ||
| ) |
Set time to live for an item in list.
TTL specifies the minimum time the Item will live, sometime soon after this time the object will be deleted.
If time to live is not specified, object lives infinitely long.
TTL could be used in order to auto-recycle old unused objects, but it is not recommended to build some app logic like timers using ttl.
| itemKey | The key of the item to adjust the ttl for. |
| ttl | Time to live in seconds from now or Item#INFINITE_DURATION to indicate no expiry. |
| listener | Async result listener. See SuccessListener. |
| void com.twilio.sync.SyncMap.setTtl | ( | int | ttl, |
| SuccessListener< Void > | listener | ||
| ) |
Set time to live for map object in seconds.
This TTL specifies the minimum time the SyncMap will live, sometime soon after this time the object will be deleted.
If time to live is not specified, object lives infinitely long.
TTL could be used in order to auto-recycle old unused objects, but it is not recommended to build some app logic like timers using ttl.
| ttl | Time to live in seconds from now or INFINITE_DURATION to indicate no expiry. |
| listener | Async result listener. See SuccessListener. |