예제 #1
0
        public PXEntryStatus GetStatus(T value)
        {
            if (this.buckets == null)
            {
                this.Initialize(0);
            }
            int hash = _Cache.GetObjectHashCode(value) & 0x7fffffff;

            for (int i = this.buckets[hash % this.buckets.Length]; i >= 0; i = this.entries[i].next)
            {
                if ((this.entries[i].hashCode == hash) && _Cache.ObjectsEqual(this.entries[i].value, value))
                {
                    return(this.entries[i].status == PXEntryStatus.Modified ? PXEntryStatus.Updated : this.entries[i].status);
                }
            }
            return(PXEntryStatus.Notchanged);
        }
예제 #2
0
        public object[] Get(PXCache sender, object item)
        {
            if (this.buckets == null)
            {
                this.Initialize(0);
            }
            int hash = sender.GetObjectHashCode(item) & 0x7fffffff;

            object[] keys = getKeys(sender, item);
            for (int i = this.buckets[hash % this.buckets.Length]; i >= 0; i = this.entries[i].next)
            {
                if ((this.entries[i].hashCode == hash) && this.objectEquals(keys, this.entries[i].keys))
                {
                    return(this.entries[i].values);
                }
            }
            return(null);
        }
예제 #3
0
        public void Put(PXCache sender, object item, params object[] values)
        {
            int free;

            if (this.buckets == null)
            {
                this.Initialize(0);
            }
            int hash = sender.GetObjectHashCode(item) & 0x7fffffff;

            object[] keys = getKeys(sender, item);
            for (int i = this.buckets[hash % this.buckets.Length]; i >= 0; i = this.entries[i].next)
            {
                if ((this.entries[i].hashCode == hash) && this.objectEquals(keys, this.entries[i].keys))
                {
                    this.entries[i].values = values;
                    return;
                }
            }
            if (this.freeCount > 0)
            {
                free          = this.freeList;
                this.freeList = this.entries[free].next;
                this.freeCount--;
            }
            else
            {
                if (this.count == this.entries.Length)
                {
                    this.Resize();
                }
                free = this.count;
                this.count++;
            }
            int k = hash % this.buckets.Length;

            this.entries[free].hashCode = hash;
            this.entries[free].next     = this.buckets[k];
            this.entries[free].keys     = keys;
            this.entries[free].values   = values;
            this.buckets[k]             = free;
        }
예제 #4
0
 public int GetHashCode(TT a)
 {
     return(_cache.GetObjectHashCode(a));
 }
예제 #5
0
 public int GetHashCode(TRecord record)
 => _cache.GetObjectHashCode(record);