Created: 2011-07-07 15:31
Updated: 2018-07-15 03:57
License: other



jquery-ajax-jstorage-cache is a plugin build for jQuery (>1.5.1) and jStorage . It's a client-side cache plugin for AJAX response intended to save bandwith and time. All the responses are stored in the Local Storage powered by HTML5 (see jStorage#Support).

How to use


	url: '/post',

	cacheJStorage: true,
	cacheKey: 'post',
	cacheTTL: 60,
	isCacheValid: function(){
		return true;

	success: function(reply) {
		// i can play with my reply ! 

On your AJAX request you got 4 new parameters :

  • cacheJStorage
    • Turn cacheJStorage on/off
    • Default: false
  • cacheTTL
    • Invalid cache after a certain time
    • In seconds
    • Deault: none ( persistant in cache )
  • cacheKey
    • CacheKey is the key that will be used to store the response in jStorage. It allow you to delete your cache easily with the jStorage.removeKey() function.
    • Default: URL + TYPE(GET/POST) + DATA
  • isCacheValid
    • This function must return true or false. On false, the cached response is removed.
    • Default: null


  • You can delete the cache by using jStorage API (see jStorage#Usage).
  • Note that you can pre-load content with this plugin. You just have do to the same AJAX request without a success callback and the same cacheKey.


This project is distributed under Apache 2 License. See LICENSE.txt for more information.

Cookies help us deliver our services. By using our services, you agree to our use of cookies Learn more