예제 #1
0
        public DBRecord Get_Item(string recordID)
        {
            recordID = NormalizeRecordPath(recordID);
            DBRecord ans = (DBRecord)(m_cache[recordID]);

            if (ans == null)
            {
                RecordInfo rawRecord = (RecordInfo)m_recordInfo[recordID];
                if (rawRecord == null)
                {
                    return(null);                                   // record not found
                }
                ans = rawRecord.Decompress(this);
                m_cache.Add(recordID, ans);
            }
            return(ans);
        }
예제 #2
0
        // The Item property caches the DBRecords, which is great when you
        // are only using a few 100 (1000?) records and are requesting
        // them many times.  Not great if you are looping through all the
        // records as it eats alot of memory.  This method will create
        // the record on the fly if it is not in the cache so when you are
        // done with it, it can be reclaimed by the garbage collector.
        // Great for when you want to loop through all the records for
        // some reason.  It will take longer, but use less memory.
        public DBRecord GetRecordUnCached(string recordID)
        {
            recordID = NormalizeRecordPath(recordID);
            // If it is already in the cache no need not to use it
            DBRecord ans = (DBRecord)(m_cache[recordID]);

            if (ans != null)
            {
                return(ans);
            }

            RecordInfo rawRecord = (RecordInfo)(m_recordInfo[recordID]);

            if (rawRecord == null)
            {
                return(null);                              // record not found
            }
            return(rawRecord.Decompress(this));
        }