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

  • Home
  • SEARCH
  • 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 7999565
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T15:32:31+00:00 2026-06-04T15:32:31+00:00

Has anyone tried invalidating a memcached namespace based on timestamp? For e.g. I need

  • 0

Has anyone tried invalidating a memcached namespace based on timestamp?
For e.g. I need to have a memcached namespace which is the timestamp of the tomcat server that hosts my API services. I need to annotate my method calls so that the namespace is a variable (rather than a constant) and it holds a timestamp of the server startup.

@ReadThroughAssignCache(namespace = "api_divisions_", assignedKey="allDivisions")
public List<Division> getAllDivisions()
{
    List<Division> all = (List<Division>)getHibernateTemplate().find("from Division");
    return all;
}

Then everytime the server starts up, the namespace on this method needs to be dynamically set to the server startup time.

Update – i know that there is a roundabout way of doing this using javaassist and dynamic annotations, but I wanted a better approach.

-Gotz

  • 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-04T15:32:32+00:00Added an answer on June 4, 2026 at 3:32 pm

    The namespace is always a constant, you cannot use variable.
    As I understand you want to create cache key using server startup time.
    There are at least two way how it can be done.
    First: use @ReadThroughSingleCache

    @ReadThroughSingleCache(namespace = "api_divisions_allDivisions")
    public List<Division> getAllDivisions(@ParameterValueKeyProvider long startup)
    {
      List<Division> all = (List<Division>)getHibernateTemplate().find("from Division");
      return all;
    }
    

    Second: use custom CacheKeyBuilder which can add timestamp to each cache key.

    Do you need old values stored before server start? If not then simple solution is to always use the same cache key and clean memcached at server starts up.

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

Sidebar

Related Questions

Has anyone tried installing SQL Server 2008 Developer on a machine that already has
Has anyone tried to back up a SharePoint web application using forms based authentication
Has Anyone tried using PDF in iPad Application, using CGPDf functions. I have used
Has anyone tried compiling SciPy 0.7.1 on Windows using numpy-1.3.0 that was built with
Has anyone tried coding in managed C++? I have a few questions : How
Has anyone tried migrating from ScrewTurn to Confluence ? I'm hoping that I can
Has anyone tried to style JButton to look like NetBeans toolbar buttons? That would
Has anyone tried that? What's your experience?
Has anyone tried to run a Win32 executable on Amazon's Windows 2008 Server image?
Has anyone tried it? Can this be used for sites that require high security

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.