DeveelDB  20151217
complete SQL database system, primarly developed for .NET/Mono frameworks
CacheAdapter.cs
Go to the documentation of this file.
1 //
2 // Copyright 2010-2015 Deveel
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 
19 namespace Deveel.Data.Caching {
20  class CacheAdapter : Cache {
21  public CacheAdapter(ICache baseCache) {
22  BaseCache = baseCache;
23  }
24 
25  protected ICache BaseCache { get; private set; }
26 
27  protected override bool SetObject(object key, object value) {
28  return BaseCache.Set(key, value);
29  }
30 
31  protected override bool TryGetObject(object key, out object value) {
32  return BaseCache.TryGet(key, out value);
33  }
34 
35  protected override object RemoveObject(object key) {
36  return BaseCache.Remove(key);
37  }
38 
39  public override void Clear() {
40  BaseCache.Clear();
41  base.Clear();
42  }
43  }
44 }
override object RemoveObject(object key)
Definition: CacheAdapter.cs:35
override void Clear()
Clear the cache of all the entries.
Definition: CacheAdapter.cs:39
Represents a cache of Objects. /summary>
Definition: Cache.cs:25
override bool SetObject(object key, object value)
When overridden in a derived class, it sets the value for the key given.
Definition: CacheAdapter.cs:27
Provides a contract to access a caching system.
Definition: ICache.cs:25
CacheAdapter(ICache baseCache)
Definition: CacheAdapter.cs:21
override bool TryGetObject(object key, out object value)
Definition: CacheAdapter.cs:31