Index: Src/GoogleApis/Apis/Util/Store/IDataStore.cs =================================================================== new file mode 100644 --- /dev/null +++ b/Src/GoogleApis/Apis/Util/Store/IDataStore.cs @@ -0,0 +1,53 @@ +/* +Copyright 2013 Google Inc + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +using System; +using System.Threading.Tasks; + +namespace Google.Apis.Util.Store +{ + /// + /// Stores and manages data objects, where the key is a string and the value is an object. + /// + /// null keys are not allowed. + /// + /// + public interface IDataStore + { + /// Stores the given value for the given key (replacing any existing value). + /// The type to store in the data store + /// The key + /// The value to store in the data store + Task Store(string key, T value); + + /// + /// Deletes the given key. The type is provided here as well because the "real" saved key should contain + /// type information as well, so the data store will be able to store the same key for different types. + /// + /// The key to delete from the data store + /// The type of the stored value + Task Delete(string key, Type t); + + /// Returns the stored value for the given key or null if not found. + /// The type to retrieve + /// The key to retrieve from the data store + /// The stored object + Task Get(string key); + + /// Clears all values in the data store. + Task Clear(); + } +} \ No newline at end of file