DeveelDB  20151217
complete SQL database system, primarly developed for .NET/Mono frameworks
TableCacheExtensions.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 using Deveel.Data.Sql;
20 using Deveel.Data.Sql.Tables;
21 
22 namespace Deveel.Data.Caching {
23  public static class TableCacheExtensions {
24  public static bool TryGetValue(this ITableCellCache cache, string database, int tableId, int rowNumber, int columnOffset, out DataObject value) {
25  var rowId = new RowId(tableId, rowNumber);
26  var key = new CellKey(database, new CellId(rowId, columnOffset));
27  return cache.TryGetValue(key, out value);
28  }
29 
30  public static void Set(this ITableCellCache cache, string database, int tableId, int rowNumber, int columnOffset, DataObject value) {
31  var rowId = new RowId(tableId, rowNumber);
32  var key = new CellKey(database, new CellId(rowId, columnOffset));
33  cache.Set(new CachedCell(key, value));
34  }
35 
36  public static void Remove(this ITableCellCache cache, string database, int tableId, int rowNumber, int columnOffset) {
37  var rowId = new RowId(tableId, rowNumber);
38  var key = new CellKey(database, new CellId(rowId, columnOffset));
39  cache.Remove(key);
40  }
41  }
42 }
bool TryGetValue(CellKey key, out DataObject value)
static void Set(this ITableCellCache cache, string database, int tableId, int rowNumber, int columnOffset, DataObject value)
Represents a dynamic object that encapsulates a defined SqlType and a compatible constant ISqlObject ...
Definition: DataObject.cs:35
static bool TryGetValue(this ITableCellCache cache, string database, int tableId, int rowNumber, int columnOffset, out DataObject value)
Defines the value of a ROWID object, that is a unique reference within a database system to a single ...
Definition: RowId.cs:24
static void Remove(this ITableCellCache cache, string database, int tableId, int rowNumber, int columnOffset)