OLD | NEW |
(Empty) | |
| 1 /* |
| 2 Copyright 2013 Google Inc |
| 3 |
| 4 Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 you may not use this file except in compliance with the License. |
| 6 You may obtain a copy of the License at |
| 7 |
| 8 http://www.apache.org/licenses/LICENSE-2.0 |
| 9 |
| 10 Unless required by applicable law or agreed to in writing, software |
| 11 distributed under the License is distributed on an "AS IS" BASIS, |
| 12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 See the License for the specific language governing permissions and |
| 14 limitations under the License. |
| 15 */ |
| 16 |
| 17 using System; |
| 18 using System.Threading.Tasks; |
| 19 |
| 20 namespace Google.Apis.Util.Store |
| 21 { |
| 22 /// <summary> |
| 23 /// Stores and manages data objects, where the key is a string and the value
is an object. |
| 24 /// <para> |
| 25 /// <c>null</c> keys are not allowed. |
| 26 /// </para> |
| 27 /// </summary> |
| 28 public interface IDataStore |
| 29 { |
| 30 /// <summary>Stores the given value for the given key (replacing any exi
sting value).</summary> |
| 31 /// <typeparam name="T">The type to store in the data store</typeparam> |
| 32 /// <param name="key">The key</param> |
| 33 /// <param name="value">The value to store in the data store</param> |
| 34 Task Store<T>(string key, T value); |
| 35 |
| 36 /// <summary> |
| 37 /// Deletes the given key. The type is provided here as well because the
"real" saved key should contain· |
| 38 /// type information as well, so the data store will be able to store th
e same key for different types. |
| 39 /// </summary> |
| 40 /// <param name="key">The key to delete from the data store</param> |
| 41 /// <param name="t">The type of the stored value</param> |
| 42 Task Delete(string key, Type t); |
| 43 |
| 44 /// <summary>Returns the stored value for the given key or <c>null</c> i
f not found.</summary> |
| 45 /// <typeparam name="T">The type to retrieve</typeparam> |
| 46 /// <param name="key">The key to retrieve from the data store</param> |
| 47 /// <returns>The stored object</returns> |
| 48 Task<T> Get<T>(string key); |
| 49 |
| 50 /// <summary>Clears all values in the data store.</summary> |
| 51 Task Clear(); |
| 52 } |
| 53 } |
OLD | NEW |