Commit Graph
8 Commits
Author SHA1 Message Date
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 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 ff8730d74b [asp.net] Removed the DEBUG ifdefs, for the tests to compile.
This is temporary until the tests are rewritten (soon)
2010-11-17 14:11:11 +01:00
Marek Habersack 3b8cd7bbce [asp.net] New version of code to purge underused entries from the cache.
This version uses an LRU cache to hold the cache items. Priority is not taken into account
when removing the underused entries (with the exception of the CacheItemPriority.NotRemovable
- items with this priority are never purged), they are treated equally.
A separate thread is not used to perform purging, instead the collection happens in the current
requests's thread.
Minor improvements to cache item enumerator and to the CheckDependencies method.
2010-11-16 04:03:26 +01:00
Marek Habersack 8940995fc8 [asp.net] Cache + SessionInProcHandler memory usage improvements
* Cache.cs: cache removes old/least recently used items when the item count exceeds 15000. Items
  are removed until they reach the count of 10000.
* SessionInProcHandler.cs: replaced ReaderWriterLock with ReaderWriterLockSlim and added a Dispose
  method to the InProcSessionItem type which disposes the associated lock and other resources.
2010-11-13 04:14:33 +01: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 dc4d82729f 2010-01-25 Marek Habersack <[email protected]>
* SqlCacheDependency.cs: added parameter checks to the
	constructors.
	Partially implemented 4.0 method CreateOutputCacheDependency

	* CacheItemUpdateReason.cs, CacheItemUpdateCallback.cs: added

	* CacheItem.cs: added OnUpdateCallback field

	* Cache.cs: implemented support for cache item update callback
	(3.5+)

	* AggregateCacheDependency.cs: added undocumented
	DependencyDispose method override

2010-01-25  Marek Habersack  <[email protected]>

	* SqlCacheDependencyTest.cs: added

svn path=/trunk/mcs/; revision=150130
2010-01-25 14:02:18 +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