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 8967467
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T17:15:00+00:00 2026-06-15T17:15:00+00:00

Had an issue where something could not be cached that effected the load on

  • 0

Had an issue where something could not be cached that effected the load on our system.

Because of a bug, my code was calling a service with incorrect parameters and that service of course returned a 404, null, empty. Basically, nothing was found to satisfy the request. The fact that nothing was found was returned to a procedure that was caching the response. My caching system does not allow us to cache the value null so we basically could not cache the response or the fact that there was no response and therefor we had to make a live call every time this scenario happened. Because of the bug it happened a lot.

I have of course fixed the bug, but my question is whether or not there is and/or should be a way to cache the fact that some resource could not be found. If we could have had such a safety net in place the bug would not have been as severe.

Should there be a way to cache the fact that something is not found or not? Why or why not?

I am using memcache servers with a spymemcached client and my code is written in Java, though my question should be agnostic to that fact. Perhaps other implementations could provide a cacheKey exists method or something like that. I have researched this and haven’t found anything in the Java world that I think is adequate for my situation. Even if there were I might not be able to switch to it because of company standards.

  • 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-06-15T17:15:01+00:00Added an answer on June 15, 2026 at 5:15 pm

    When you need to know whether or not a value exists, and null is a valid value, I would typically use a “holder” or “singleton” class. For example:

    public final class Singleton<T> {
      private final T value;
      public Singleton(T value) {
        this.value = value;
      }
      private final T get() {
        return value;
      }
    }
    

    So now instead of:

    // if this returns null, does it mean the document doesn't exist 
    // or there's nothing in the cache?
    public Document getCached(String name);
    

    You can use:

    // if this returns null, there's nothing in the cache
    // if non-null, the singleton wrapper may contain a null value,
    // indicating the document doesn't exist
    public Singleton<Document> getCached(String name);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I had an issue with my game that allowed people to easily fake their
I had an issue with my search not return the results I expect. I
I've consistently had an issue with parsing XML with PHP and not really found
I've had an issue that I thought was tinyMCE, then my db, now I
i've often had this issue where i do not really understand how to pass
Lately I had an issue with an array that contained some hundred thousands of
I'm having an issue that apparently many people have had as well, only what
I had an issue where I was sending a POST to Grails 1.3.7 with
I had an issue playing with Gallery when I changed a setting. However, I
I had an issue installing Visual Studio 2010 RC on Windows XP SP3 ?

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.