Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4027078
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T11:03:06+00:00 2026-05-20T11:03:06+00:00

In our application we are caching some frequently used data. Recently we have developed

  • 0

In our application we are caching some frequently used data. Recently we have developed a jquery plugin for our web app. Some of the plugin methods needs to access application cache.
I tried to access the cache, and result is undefined.

For example:

Application Class

Application(){
cachedObjects = {};
}

<body>
$(function(){
Application();
});

Plugin:

(function( $ ){

var methods = {
initialize : function( options ) { },
getDataFromCache : function() { 
var data = Application.cachedObjects.someObject;// Here, data is undefined.
 }
};

 $.fn.menuPlugin = function( method ) {
 if ( methods[method] ) {
  return methods[ method ].apply( this, Array.prototype.slice.call( arguments, 1 ));
 } else if ( typeof method === 'object' || ! method ) {
  return methods.initialize.apply( this, arguments );
} else {
}    

};
})( jQuery );

How can i access those application objects?

Any suggestions would be appreciative.

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T11:03:07+00:00Added an answer on May 20, 2026 at 11:03 am

    There are many problems here. First you define a function without the function keyword. Second you declare cachedObjects without the var keyword, so it becomes global. I think what you mean is

    function Application(){
        var cachedObjects = {};
    }
    

    In any case cachedObjects will only be a local variable inside Application, not a property of the Application object (which happens to be a function).

    You can declare an Application object in a much simpler way with

    var Application = {
        cachedObjects: {}
    };
    

    In any case, if you are developing a jQuery plugin you should not create a global variable Application; you can use a variable local to your plugin like

    (function($) {// All the definition of your plugin goes in this function
        var Application = ...
    })(jQuery);
    

    or store the cached data in a closure.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Our application is interfacing with a lot of web services these days. We have
Our application is written in C++ and used on Windows XP. On some client
We have an application with very heavy UI. Recently our clients started complaining to
Our application has a very large, wide table of transactional data. We have a
We are looking at implementing a caching framework for our application to help improve
Our application is well structured (well we did our best!) and we have split
We have an application that performs comparisons on data objects to determine if one
To make my extranet web application even faster/more scalable I think of using some
We've created a caching layer to our J2EE-application. In this instance we use Ehcache.
We are attepting to profile our NHibernate application using NHProf. We have a series

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.