예제 #1
0
        public T Read(ulong id, DatabaseLocationType type)
        {
            switch (type)
            {
            case DatabaseLocationType.MemoryAndDisk:
                return(ReadFromMemoryFirstThenDisk(id));

            case DatabaseLocationType.MemoryOnly:
                return(TryGetElementFromMemory(id));

            case DatabaseLocationType.DiskOnly:
                return(TryGetElementFromDiskByID(id));
            }

            throw new Exception("unsupported read method");
        }
예제 #2
0
        public bool Store(T e, DatabaseLocationType type)
        {
            switch (type)
            {
            case DatabaseLocationType.MemoryAndDisk:
                return(ForceStoreToMemory(e) && ForceStoreToDisk(e));

            case DatabaseLocationType.MemoryOnly:
                return(ForceStoreToMemory(e));

            case DatabaseLocationType.DiskOnly:
                return(ForceStoreToDisk(e));
            }

            throw new Exception("unsupported store method");
        }
예제 #3
0
 public T Read(string id, DatabaseLocationType type)
 {
     return(Read(DatabaseElement.GenerateID(id), type));
 }