Esempio n. 1
0
    public override void Save(string id, byte[] data, string blackImageFile)
    {
        this.AcquireWriterLock();
        try
        {
            StringCollection keys = new StringCollection();
            foreach (string key in this._storeItems.Keys)
            {
                ChartStoreItem item1 = this._storeItems[key];
                if (item1.IsExpired(this._timeoutInMinutes))
                {
                    keys.Add(key);
                }
            }

            foreach (string key in keys)
            {
                this._storeItems.Remove(key);
            }


            this._storeItems.Add(id, new ChartStoreItem(id, data, blackImageFile));
        }
        finally
        {
            this.ReleaseWriterLock();
        }
    }
Esempio n. 2
0
    public override byte[] Load(string id, out string fileName, out string blackImageFile)
    {
        fileName       = null;
        blackImageFile = null;

        this.AcquireReaderLock();
        try
        {
            ChartStoreItem item = null;
            if (this._storeItems.TryGetValue(id, out item))
            {
                fileName       = item.FileName;
                blackImageFile = item.BlackImageFile;
                return(item.Data);
            }
            else
            {
                return(null);
            }
        }
        finally
        {
            this.ReleaseLock();
        }
    }