Example #1
0
        private void RegisterVariableToPool(string name, object value)
        {
            VariablePoolPreCache.CleanCachedVariables(this._SessionKeyID, name);

            byte[] serializedValue;
            Stream forStream = null;

            try
            {
                forStream = new MemoryStream();

                BinaryFormatter binFormater = new BinaryFormatter();
                binFormater.Serialize(forStream, value);

                serializedValue = ((MemoryStream)forStream).ToArray();
            }
            catch (Exception)
            {
                serializedValue = new byte[] { };
            }
            finally
            {
                if (forStream != null)
                {
                    forStream.Close();
                    GC.SuppressFinalize(forStream);
                }
            }

            VariablePoolOperation._Cache.Set(name, serializedValue);
        }
Example #2
0
        private void UnRegisterVariableFromPool(string name)
        {
            VariablePoolPreCache.CleanCachedVariables(this._SessionKeyID, name);

            // Unregister Variable From Pool Immidiately.
            // Otherwise it will cause cache reload in the same domain call
            VariablePoolOperation._Cache.Set(name, null);
        }