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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T00:04:59+00:00 2026-06-13T00:04:59+00:00

Using com.google.appengine.api.memcache.MemcacheService for caching in App Engine, I’m creating the memcacheservice instance using a

  • 0

Using com.google.appengine.api.memcache.MemcacheService for caching in App Engine, I’m creating the memcacheservice instance using a factory, and injecting it into my classes with spring as a singleton.

I’m asking if this is correct and optimal and if anyone has input on the positive or negative effect of using the lazy-init option or synchronized(). I’d like to have the answer to this question result in the best possible way to use memcacheservice in this manner.

Thanks!

Factory:

public class CacheFactory {

    private static MemcacheService INSTANCE;

    private CacheFactory() {
    }

    public static MemcacheService getInstance() {
        if (INSTANCE == null) {
            synchronized(CacheFactory.class){
            INSTANCE =  MemcacheServiceFactory.getMemcacheService();
            }
        }
        return INSTANCE;

    }



}

Spring Bean:

 <bean id="cacheFactory" class="com.nimbits.server.transactions.memcache.CacheFactory"
          factory-method="getInstance" lazy-init="false" scope="singleton" >
    </bean>

sample usage:

   <bean id="someService" class="SomeServiceImpl">
        <property name="cacheFactory" ref="cacheFactory" />
   </bean>
  • 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-13T00:05:00+00:00Added an answer on June 13, 2026 at 12:05 am

    This solution will work but it is problematic:

    1. You should clearly understand that it is not a complete singleton because every instance will have its own instance of your factory.

    2. It will affect dynamic instances start time. There is a known problem that every spring bean will add some time to instance start time. SO if your HTTP request will cause instance to start there will be a delay between request start and actual response process. A lot of people faced this problem during last several; months. Instance start can be even more than 60 second and you will got hard deadline Exception. So there is a recommendation not to use Spring at all to speed up start time. Check http://code.google.com/p/googleappengine/issues/detail?id=7706 for details.

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

Sidebar

Related Questions

I've got a GAE in Python and I am using the Channel API: https://developers.google.com/appengine/docs/python/channel/functions
I'm having trouble retrieving 2 artifacts in my Maven/Java/Google App Engine project: com.google.appengine.orm:datanucleus-appengine:jar:1.0.7.final com.google.appengine:appengine-api-1.0-sdk:jar:1.3.4
I am using instructions provided at http://code.google.com/appengine/articles/openid.html to enable Federated Authentication in App Engine.
I'm using google.appengine.api urlfetch to preform the following freebase MQL query: https://api.freebase.com/api/service/mqlread?queries={q1: {query: [{subjects:
How can I automatically read a Entity (com.google.appengine.api.datastore.Entity) into a object using GoogleAppEngine Low
I'm using http://code.google.com/p/flex-iframe/ for showing wikicontent in a flex app. <?xml version=1.0?> <mx:TitleWindow xmlns:mx=http://www.adobe.com/2006/mxml
I have successfully sent an email using the Google App Engine. However the only
I read the doc: from google.appengine.api import mail mail.send_mail(sender=support@example.com, to=Albert Johnson <Albert.Johnson@example.com>, subject=Your account
I'm trying to download data from my Google App Engine app, using the official
I want to upload one image to the database by using Google app engine

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.