-
Notifications
You must be signed in to change notification settings - Fork 66
Full support for CacheDependency and accessors #276
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Move caching to HttpRuntime and make all Cache accessor methods use that entry point Add Cache accessors to HttpRuntime and HttpContextBase
|
Test failure: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the thread safety model here? I'm a little surprised not to see any locking anywhere.
The Cache implementation is a wrapper around a I don't think any of the code I've added actually requires any specific locking logic, although maybe I've missed a scenario where it would be applicable? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! My main concern is around the use of the static HttpRuntime. I'm fine exposing APIs that were there in ASP.NET Framework, but internally, we shouldn't be using those statics for things but access it through the DI container.
src/Microsoft.AspNetCore.SystemWebAdapters.CoreServices/HttpRuntimeFactory.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.AspNetCore.SystemWebAdapters/HttpContextWrapper.cs
Outdated
Show resolved
Hide resolved
test/Microsoft.AspNetCore.SystemWebAdapters.CoreServices.Tests/CacheTests.cs
Outdated
Show resolved
Hide resolved
test/Microsoft.AspNetCore.SystemWebAdapters.CoreServices.Tests/CacheTests.cs
Outdated
Show resolved
Hide resolved
test/Microsoft.AspNetCore.SystemWebAdapters.CoreServices.Tests/CacheTests.cs
Show resolved
Hide resolved
It think it was a combination of copying from the original design in net4 and thoughts to performance, as if we hit DI every time we need access to the cache, rather than using a static property that is initialized once from the singleton, it might hurt the performance. string cachedString;
cachedString = (string)HttpRuntime.Cache["CacheItem"];
if (cachedString == null)
{
cachedString = "Hello, World.";
HttpRuntime.Cache.Insert("CacheItem", cachedString);
}Where I have removed this from |
Full support for CacheDependency and accessors.
Complete the implementation of
System.Web.Caching.CacheDependencyand provide all the accessors from System.Web implementation.Description
Implement all constructors and features of
System.Web.Caching.CacheDependencyAdd extensions to allow handling various underlying
ChangeMonitorimplementations to surface theUtcLastModifiedproperty.Implements
CacheDependencyChangeMonitorto allow aCacheDependencyto rely on another item in the Cache.Adds
Cacheaccessor toHttpContext,HttpContextBase,HttpContextWrapper, andHttpRuntimeModifies
HttpRuntimeFactoryto allow getting the Cache implementationUpdates tests to support new
IHttpRuntimeinterface member.Addresses #26