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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T22:33:08+00:00 2026-06-04T22:33:08+00:00

I’ve been trying to learn about memcached usage etc. and trying to set it

  • 0

I’ve been trying to learn about memcached usage etc. and trying to set it up from yesterday by reading few scarce resources out there. Let me begin by showing what I have.

  1. Installed memcached server
  2. Configured for spring as explained here:

    <beans xmlns="http://www.springframework.org/schema/beans" 
        xmlns:aop="http://www.springframework.org/schema/aop"
        xsi:schemaLocation="http://www.springframework.org/schema/beans
                http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
                http://www.springframework.org/schema/aop
                http://www.springframework.org/schema/aop/spring-aop-3.0.xsd">
    
        <import resource="simplesm-context.xml" />
        <aop:aspectj-autoproxy />
    
        <bean name="defaultMemcachedClient" class="com.google.code.ssm.CacheFactory">
              <property name="cacheClientFactory">
                    <bean class="com.google.code.ssm.providers.xmemcached.MemcacheClientFactoryImpl" />
              </property>
              <property name="addressProvider">
                    <bean class="com.google.code.ssm.config.DefaultAddressProvider">
                         <property name="address" value="127.0.0.1:11211" />
                    </bean>
              </property>
              <property name="configuration">
                    <bean class="com.google.code.ssm.providers.CacheConfiguration">
                          <property name="consistentHashing" value="true" />
                    </bean>
              </property>
         </bean>
    </beans>
    
  3. Successfully created connection to the server trough spring :

    20:06:07,864 WARN  [main] (XMemcachedClient.java:645) - XMemcachedClient use Text protocol
    20:06:08,112 WARN  [main] (AbstractController.java:372) - The Controller started at localhost/127.0.0.1:0 ...
    20:06:08,139 WARN  [Xmemcached-Reactor-0] (MemcachedConnector.java:239) - Add a session: 127.0.0.1:11211
    

So next step was to test it, this offers good/simple explanation about memcached : http://www.majordojo.com/2007/03/memcached-howto.php

I wanted to try this bit :

Class Foo {
    public static findById(id) {
            if (obj = memcached.get(id)) return obj;
            obj = loadFromDatabase(id);
            memcached.put(id,obj);
            return obj;
        }
}

But nowhere on this site does it say which type of object is memcached. So I tried with following :

import net.rubyeye.xmemcached.MemcachedClient

Class Foo {
        @Autowired
    MemcachedClient defaultMemcachedClient;
        public static findById(id) {
                if (obj = memcached.get(id)) return obj;
                obj = loadFromDatabase(id);
                memcached.put(id,obj);
                return obj;
            }
    }

Error I got from the logs is :

nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No matching bean of type [net.rubyeye.xmemcached.MemcachedClient] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency

I thought defaultMemcachedClient bean is supposed to be my memcached client. It’s not obviously. What do I do here? Anyone has idea? Link? Advice? Anything?

  • 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-04T22:33:09+00:00Added an answer on June 4, 2026 at 10:33 pm

    The defaultMemcachedClient bean is of type Cache and has nothing to do with xmemecached.

    If you want to use memcached directly don’t use Simple Spring Memcached. The SSM is for caching using interceptors (AOP) and annotation. In your case:

    public class Foo {
        // cache for 1 hour
        @ReadThroughSingleCache(namespace="foo", expiration=3600)
        public Object findById(@ParameterValueKeyProvider int id) {
                return loadFromDatabase(id);
        }
    }
    

    When this method is called, before invoking body of this method interceptor check if there’s any value in cache under key (key is created using namespace and id parameter). If there’s a value in cache it is returned to caller and body of method (loadFromDatabase) is not executed. If there’s no value in cache body of method is executed and result is stored in cache and returned to caller.

    If you want to use memcached client directly you can still use Cache object from SSM but you may be interested in using xmemcached.

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

Sidebar

Related Questions

I am reading a book about Javascript and jQuery and using one of the
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I have a jquery bug and I've been looking for hours now, I can't
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am trying to render a haml file in a javascript response like so:
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this

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.