caching

Manipulating Hibernate 2nd Level Cache

I am using hibernate as my ORM solution, with EHCache as the Second Level (Read-Write) cache. My question is: Is it possible to access the Second Level cache directly? I want to access this: http://www.hibernate.org/hib_docs/v3/api/org/hibernate/cache/ReadWriteCache.html How can I access the same ReadWriteCache that is being used b...

Domain aliasing vs edge side includes for CDN

I'm designing a web application to support use of a CDN in the future. Two options I've considered: Use domain aliasing for static content on the site, including CSS, JS, and some images. Use "edge side includes" to designate static content regions. (1) is simpler and I've implemented it before. For example, we would prefix each IMG...

Removing specific items from Cache (ASP.NET)

I am adding a bunch of items to the ASP.NET cache with a specific prefix. I'd like to be able to iterate over the cache and remove those items. The way I've tried to do it is like so: foreach (DictionaryEntry CachedItem in Cache) { string CacheKey = CachedItem.Key.ToString(); if(CacheKey.StartsWith(CACHE_PREFIX)...

'Cached' behaviour of 'hotfixed' dlls

Sometimes, a customer (or tester) needs a patch on an installation of the product I work on. Sometimes, I brew him a dll containing the fix, so that he can test it. He overwrites the old dll with the new version and restarts the app. Every now and then, it appears that the 'new' dll isn't actually used, although I'm absolutely positiv...

Caching data from other websites in Django

Suppose I have a simple view which needs to parse data from an external website. Right now it looks something like this: def index(request): source = urllib2.urlopen(EXTERNAL_WEBSITE_URL) bs = BeautifulSoup.BeautifulSoup(source.read()) finalList = [] # do whatever with bs to populate the list return render_to_response('...

Rails Caching - XML Files?

My Rails application is running on a VM. The VM's performance is just fine with static pages. In fact, I'm running another site using Apache virtual hosting that is just serving up static HTML files and the response is adequate. However, my Rails application that is dynamically generating XML files responds very slowly. In fact, it takes...

Does this Caching function work how I think it does?

I've tentatively written this method: public static Func<T> WeakCacheFor<T>( Func<T> provider ) where T: class { var cache = new WeakReference(null); return () => { var x = (T)cache.Target; if( x == null ) { x = provider(); cache.Target = x; } return x; }; } S...

How to implement cache for Ajax requests

I have simple application, that shows list of many items, where user can display detail for each item, which is obtained by Ajax. However, if user closes the detail and opens again, application makes another Ajax request, to get the same content again. Is there any simple solution how to prevent this by caching requests on client, so w...

Is it possible to automatically derive the components of a cache-key in rails?

When generating cache-keys for rendered content in web applications, you have to take into account all variables that might change the result. In dynamic environments like rails these can be defined in different places: the controller, a model, the session or the server environment. And they can be referenced in the template, in a templa...

asp.net mvc usercontrol caching

Hi Using MVC 1.0 How can i cache a page but not a user control on it. lets say i have a tag cloud on my master page, tag cloud being a user control that i want refreshed only every x minutes. do i need to do [Donut caching][1]? or has it made it to MVC 1.0 ? can it be done in client browser or only server caching ? [1]: http://ha...

How to prevent browser page caching in Rails

Ubuntu -> Apache -> Phusion Passenger -> Rails 2.3 The main part of my site reacts to your clicks. So, if you click on a link, it will send you on to the destination, and instantly regenerate your page. But, if you hit the back button, you don't see the new page. Unfortunately, it's not showing up without a manual refresh; it appears ...

Can IIS serve Most Frequently Used static files from RAM?

Can I set up an IIS server so that it will cache the most frequently used static files (binary) from disk into RAM, and serve from RAM on request? Update: mod_mem_cache in Apache Caching Guide seems to be what I'm looking for. Any equivalent thing in IIS? Thanks. ...

How can I write a caching HTTP proxy in Perl?

I intend to write a simple HTTP proxy in Perl using the HTTP::Proxy module. I'm clear with the very basic task of how to create a proxy and basic filters and stuff. But what I cannot understand is how to manually force-serve a file through cache. Basically, the scenario is this that I run this proxy in computer A. The user on computer ...

Create Your Own .NET Assembly Cache

Hello everyone, In a .net application I am writing, I need to locally cache assemblies from various locations so my application can use them even if the original locations are unavailable. I cannot use the GAC (primarily because I want portability and also because the assemblies might not be signed). Does anyone know of any .net cod...

A question about cache of filesystem.

When I read a large file in the file system, can the cache improve the speed of the operation? I think there are two different answers: 1.Yes. Because cache can prefetch thus the performance gets improved. 2.No. Because the speed to read from cache is more faster than the speed to read from disk, at the end we can find that the cach...

Does the Python library httplib2 cache URIs with GET strings?

In the following example what is cached correctly? Is there a Vary-Header I have to set server-side for the GET string? import httplib2 h = httplib2.Http(".cache") resp, content = h.request("http://test.com/list/") resp, content = h.request("http://test.com/list?limit=10") resp, content = h.request("http://test.com/list?limit=50") ...

Can remote stateless session bean references be cached in EJB3?

I am calling a remote stateless session bean from a J2SE application and would like to cache the reference to the session bean in order to reduce the cost of the lookup. Is this ok? In EJB2 the ServiceLocator pattern was commonly used to cache lookups to remote resources, but EJB3 doesn't have separate EJB Home (which were usually cach...

Caching ActiveRecord object and associations

I want to be able to "deep clone" 10 instances of an ActiveRecord model and all its associations into memory, work on them, update the in-memory objects and then, when I've finished, pick one to write back over the original in the database. How do I deep clone (i.e. .clone but also cloning all associations right down to the bottom of t...

Thread-safe one time calculation best practices

It's quite common that I need a property in my class which needs to be calculated and cached. Generally I use a lock and a boolean top check if it's processed or not. Sometimes I do it in accessors. What's the performance hit of this approach? Is there any better way to it. Sample Code of my common approach to this: Sub Main() ...

Open source profiler for analyzing low-level architectural inefficiencies?

Modern processors use all sorts of tricks to bridge the gap between the large speed of their processing elements and the tardiness of the external memory. In performance-critical applications the way you structure your code can often have a considerable influence on its efficiency. For instance, researchers using the SLO analyzer were ...