caching

Cache Function results

For fun, I'm playing with a class to easily cache function results. The basic idea is that you can take any function you want though you'd only want to use it for relatively expensive functions and easily wrap it to use relatively inexpensive dictionary lookups for later runs with the same argument. There's really not much to it: pu...

Strategy for keeping semi-static data fresh

I'm working on a winform app that will be used by groups in the US and overseas that replaces an existing app built with older technologies. Performance of the old app overseas is pretty slow due to excessive calls back to the database server in the US, so I'd like to cache as much stuff on the client as possible. What is the best way...

Basic cache question

Say I have a JSF backing bean, request scope, that has a List as a member. In the backing bean, I have a method that is bound to a button on the page. When the button is first pressed, the method uses an EJB to populate the list. Upon subsequent presses of the button, I do not want the method to call the DB. So, I added a check: if(li...

ASP.NET MVC, Cache individual User Control

How do I cache an individual user control with ASP.NET MVC? I also need the VaryByParam etc support that usually comes with ASPX Output Caching. I don't want to cache the entire action though, only one of my user controls in the view. An example would be nice :) Thank you! ...

Is a Session-Based Cache Solution Viable?

I am wondering if it is viable to store cached items in Session variables, rather than creating a file-based caching solution? Because it is once per user, it could reduce some extra calls to the database if a user visits more than one page. But is it worth the effort? ...

Can Tangosol Coherence cache non-serializable objects?

I'm using Tangosol Coherence v3.2.2b371. Can I cache objects that do not implement Serializable through the NamedCache api? Or this depends on configuration? Edit: For clarification, I'm trying to cache compiled javax.xml.xpath.XPathExpression objects. ...

How can I set the Cache-Control header for every response in Catalyst?

It seems that by default Catalyst does not output Cache-Control:, etc. headers. I know I can output them in a given controller method like this: $c->response->headers->last_modified(time); $c->response->headers->expires(time + $self->{cache_time}); $c->response->headers->header(cache_control => "public, max-age=$self->{cache_time}"); ...

Will proxies cache HTTP Responses when authentication is provided?

Given a URI which has headers for caching properly configured. If two users make a request to the same URI but provide two different sets of credentials, will a proxy cache the response per user+URI, or per URI, or not at all? ...

ASP.net - Caching by Query-String (VaryByParam)

In which situations should we use Query-Strings (VaryByParam) to achieve Caching in ASP.NET? Can anyone give an example of a real-life situation in case of an web-application? ...

CakePHP cache control for asset files (images, CSS, etc)

What's the best way to use CakePHP to control the Expires headers for image and CSS files? My host unfortunately doesn't support mod_expires or mod_headers, so I can't simply set these values in an .htaccess file. Right now there's no cache control for my files and a lot of unnecessary requests are made. What's the most elegant way to ...

Why doesn't Cache::clear() clear my (view) cache? (CakePHP)

Even though it's documented that CakePHP will automatically clear the view caches when a model is updated, it doesn't. It is important to remember that Cake will clear a cached view if a model used in the cached view is modified. For example, if a cached view uses data from the Post model, and there has been an INSERT, UPDATE, or DEL...

Pick up a cache implementation, or roll your own?

I'm doing a Java EE application, and I'm at a point where I've concluded that I need a cache for my objects. My current requirements aren't much more complicated than some kind of key-value storage, possibly something that can handle a tree. It would be tempting to write a simple custom static/singleton class containing one or more maps...

Cache Invalidation - Is there a General Solution?

"There are only two hard problems in Computer Science: cache invalidation and naming things." Phil Karlton Is there a general solution or method to invalidating a cache; to know when an entry is stale, so you are guaranteed to always get fresh data? For example, consider a function getData() that gets data from a file. It caches i...

Mono ASP.Net Web Service CacheDuration hit ratio, under Linux.

I have developed an ASP.Net Web Service targeting Mono. I have deployed it to an OpenSUSE 11.1 VM running Mono under Apache. Is there a way to monitor the @OutputCache hit ratio for my ASP.Net app deployed for Mono under a Linux OS similar to the Windows Performance Monitor, for example? This does not have to necessarily involve perfo...

Django cache.set() causing duplicate key error

My Django site recently started throwing errors from my caching code and I can't figure out why... I call: from django.core.cache import cache cache.set('blogentry', some_value) And the error thrown by Django is: TransactionManagementError: This code isn't under transaction management But looking at the PostgreSQL database logs, i...

Cache Object in PHP without using serialize

I have a complex object that I create in a PHP script. I am looking for a way to store this object such that subsequent requests do not have to recreate it, or spend time unserializing and rebuilding it. Using xdebug I find that I spend half of the entire request time building this object. Even when I store the object explicitly in APC (...

What is the easiest / most transparent way of caching methods in spring?

If I have a bunch of DAO's with a bunch of getXXX methods and I want all or some explicit list of the methods cached is there any way I can do this transparently with Spring? What I don't want is: To change any source code / add anotations Manually have to create a number of proxy beans for a number of DAO's and rewire them all. Ide...

How to check whether the images are from cache

Hi all, How to check whether the images are from cache or from server. Since my home page contains 45 images. When I press F5, want to know whether the images are from cache or from server. I had added <%@ OutputCache Duration='120' Location='Client' VaryByParam='none' %> Thanks, Babu Kumarasamy. ...

Is data retrieved over SSL cached by the client browser?

I know that data retrieved over SSL (https) is encrypted over the wire, but once it arrives at the browser, is it stored in the client's browser cache? If so, is it stored encrypted or in plain text? This probably depends on the browser, so perhaps different browsers do different things? Modern browsers better behaved than outdated on...

How do I cache configure settings for static libraries that are built using Ant scripts and SCONS?

Currently, we build a group of static libraries prior to building our app. The issue is that for each library there is some variation of the ./configure, make , test sequence. I would like to be able to cache the results of the configure step to speed up the build, since it is common to build on the same platform multiple times. We are t...