13 Commits
Author SHA1 Message Date
Martin 43abdc0936 completes commit 6744423723 2011-12-29 14:58:18 +01:00
QuickJack 6744423723 Fixes a warning in System.Web..dll 2011-12-29 12:45:22 +01:00
Marek Habersack 0eff07d0fc [asp.net] Better handling of item timeout reset in the in-proc session handler
The in-proc session handler no longer removes and re-inserts an item in order to
update its timeout. It is now done using Cache.SetItemTimeout which, in turn, checks
whether the item being updated is already a timed one and, if yes, calls CacheItemPriorityQueue's
Update method for that item. Should the update fail or the item is not yet timed, the item is
enqueued to the priority queue in the regular fashion.

CacheItem got a new member, PriorityQueueIndex to mark its position in the queue's heap for faster
lookup and manipulation.

The CacheItemPriorityQueue.BubbleDown method was rewritten to properly swap items in the heap.
2011-04-11 14:48:13 +02:00
Marek Habersack 2ec75014bd [asp.net] Store new heap size when shrinking it. Thanks to Rodrigo Kumpera for noticing it!
This should fix the IndexOutOfRangeError which occur after heap exceeds 8192 elements and is then
shrunk below that value.
2011-04-02 02:36:53 +02:00
Marek Habersack 4b785e19d7 [asp.net] Disabled array clearing on heap resize in CacheItemPriorityQueue as it causes NREX to be thrown with > 8192 items in the queue.
- Rewrote the CacheItem priority queue test generator to generate better code.
- CacheItem in System.Web doesn't have the unused Guid field now (the field is used only for tests)
- Added a huge sequence to CacheItem priority queue tests (10k entries)
2010-11-19 02:30:16 +01:00
Marek Habersack 90768d5b2d [asp.net] Added a reminder comment about stack scanning in CacheItemPriorityQueue.ResizeHeap 2010-11-19 02:30:16 +01:00
Marek Habersack d65749c571 [asp.net] A few memory usage optimizations.
* System.Web.Caching/CacheItemPriorityQueue.cs: when the heap is resized, the old heap memory
  is cleared.
* System.Web.SessionState_2.0/SessionInProcHandler.cs: the session items collection is cleared
  when the InProcSessionItem is destroyed
* System.Web/HttpApplicationState.cs: instantiate SessionObjects and StaticObjects collections
  only on demand.
  Replaced ReaderWriterLock with ReaderWriterLockSlim.
  Removed a few variables which aren't needed.
* System.Web/HttpStaticObjectsCollection.cs: replaced a Hashtable with a Dictionary <string, object>.
  The objects dictionary is created on demand only.
2010-11-18 02:21:47 +01:00
Marek Habersack ae23776616 [asp.net] Get rid of a possible (although unlikely) race condition when acquiring locks
The patch removes a small race condition where a boolean flag is set after acquiring a lock to
indicate to code executing in the finally {} block that it should release the lock. The boolean
variable is now removed and the lock is released unconditionally. It carries a potential to
throw an exception when the lock is not held, but it's better than to fail to release it and
lead the application to a deadlock.
2010-09-28 13:29:21 +02:00
Marek Habersack 73c3bfba56 2010-02-03 Marek Habersack <[email protected]>
* AssemblyInfo.cs: added back InternalsVisibleTo for the test
        assembly - it's needed to access CacheItemPriorityQueue

2010-02-03  Marek Habersack  <[email protected]>

        * OutputCache.cs: DefaultProviderName checks if there was any
        provider configured and, if not, returns a built-in provider's
        name.

        * SqlCacheDependencyAdmin.cs: added

        * OutputCacheProviderCollection.cs: added

        * OutputCacheProvider.cs: added

        * OutputCacheModule.cs: uses the 4.0 extensible output cache
        provider model now (also internally in the 2.0 profile)
        OutputCacheProvider is retrieved on every request using
        HttpApplication.GetOutputCacheProviderName (4.0+). In the 2.0
        profile an instance of InMemoryOutputCacheProvider is always
        returned.

        * InMemoryOutputCacheProvider.cs: default output cache provider
        for ASP.NET 4.0, also used internally in the  2.0 profile.

        * CachedVaryBy.cs: made the generated key shorter

        * CacheItemPriorityQueueDebug.cs: debugging support for
        CacheItemPriorityQueue. Most of the code is compiled only when the
        DEBUG macro is defined. Debugging support includes recording of
        the queue operations sequence which is output to an XML file on
        appdomain shutdown. The recorded sequence files can be used to
        generate NUnit test cases for the priority queue (see
        ../Test/tools/README)

        * CacheItemPriorityQueue.cs: rewritten using an array based heap
        instead of a binary tree based one - implementation is simpler,
        faster and more elegant. Heap is initially 32 entries long and
        its size is doubled every time it fills up. After reaching a
        threshold (8192 entries currently) it is shrunk to the number of
        items + 1/3 of item count in order to preserve memory.

        * CacheItem.cs: added a Guid field to easier distinguish items
        (mostly for debugging purposes)

        * CacheDependency.cs: minor performance improvements

        * Cache.cs: better handling of timer periods

2010-02-03  Marek Habersack  <[email protected]>

        * HttpApplication.cs: GetOutputCacheProviderName returns the value
        of OutputCache.DefaultProviderName

        * HttpRuntime.cs: internal cache is used to hold the dependencies
        now.

2010-02-03  Marek Habersack  <[email protected]>

        * CacheItemPriorityQueueTest_generated.cs: added

        * CacheItemPriorityQueueTest.cs: added

2010-02-04  Marek Habersack  <[email protected]>

        * Helpers.cs: added a helper method for checking of HTML mentions
        any .NET exceptions.

2010-02-03  Marek Habersack  <[email protected]>

        * Makefile: added targets to compile cache priority queue tests
        generator and to generate the tests themselves

svn path=/trunk/mcs/; revision=150855
2010-02-04 13:53:55 +00:00
Marek Habersack 0bf9d45936 2010-01-06 Marek Habersack <[email protected]>
* CacheItemPriorityQueue.cs: make sure lastParent is never null if
	root is not null in Enqueue. Possible fix for bug #567869

svn path=/trunk/mcs/; revision=149118
2010-01-06 10:46:45 +00:00
Marek Habersack ad05a7a2e2 2009-10-21 Marek Habersack <[email protected]>
* CacheItemPriorityQueue.cs: lock the queue on enqueue/dequeue

svn path=/trunk/mcs/; revision=144562
2009-10-21 19:11:40 +00:00
Marek Habersack 9bbf3c9b00 Removed debugging code
svn path=/trunk/mcs/; revision=142774
2009-09-28 18:08:03 +00:00
Marek Habersack aa68b0b904 2009-09-26 Marek Habersack <[email protected]>
* CacheItemPriorityQueue.cs, CacheItem.cs, CacheItemEnumerator.cs:
	added

	* Cache.cs: factored out CacheItem and CacheItemEnumerator to
	separate files.
	Use reader-writer locks instead of Monitor.
	Added two 3.5sp1 properties - EffectivePrivateBytesLimit and
	EffectivePercentagePhysicalMemoryLimit.
	Added support for disabling cache item expiration.
	One timer is used to expire all timed items (instead of one timer
	per item). Timed items are kept in a priority queue.

svn path=/trunk/mcs/; revision=142664
2009-09-25 22:28:21 +00:00