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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T07:40:19+00:00 2026-05-29T07:40:19+00:00

I have site on Pyramid framework and want to cache with memcached. For testing

  • 0

I have site on Pyramid framework and want to cache with memcached. For testing reasons I’ve used memory type caching and everything was OK. I’m using pyramid_beaker package.
Here is my previous code (working version).

In .ini file

cache.regions = day, hour, minute, second
cache.type = memory
cache.second.expire = 1
cache.minute.expire = 60
cache.hour.expire = 3600
cache.day.expire = 86400

In views.py:

from beaker.cache import cache_region

@cache_region('hour')
def get_popular_users():
    #some code to work with db
return some_dict

The only .ini settings I’ve found in docs were about working with memory and file types of caching. But I need to work with memcached.

First of all I’ve installed package memcached from Ubuntu official repository and also python-memcached to my virtualenv.

In .ini file I’ve replaced cache.type = memory -> cache.type = memcached. And I’ve got next error:

beaker.exceptions.MissingCacheParameter

MissingCacheParameter: url is required

What am I doing wrong?

Thanks in advance!

  • 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-29T07:40:20+00:00Added an answer on May 29, 2026 at 7:40 am

    So, using the TurboGears documentation as a guide, what settings do you have for the url?

    [app:main]
    beaker.cache.type = ext:memcached
    beaker.cache.url = 127.0.0.1:11211
    # you can also store sessions in memcached, should you wish
    # beaker.session.type = ext:memcached
    # beaker.session.url = 127.0.0.1:11211
    

    It looks to me as if memcached requires a url to initialize correctly:

    def __init__(self, namespace, url=None, data_dir=None, lock_dir=None, **params):
        NamespaceManager.__init__(self, namespace)
    
        if not url:
            raise MissingCacheParameter("url is required") 
    

    I am not really sure why the code allows url to be optional (defaulting to None) and then requires it. I think it would have been simpler just to require the url as an argument.


    Later: in response to your next question:

    when I used cache.url I’ve got next error: AttributeError:
    ‘MemcachedNamespaceManager’ object has no attribute ‘lock_dir’

    I’d say that the way I read the code below, you have to provide either lock_dir or data_dir to initialize self.lock_dir:

        if lock_dir:
            self.lock_dir = lock_dir
        elif data_dir:
            self.lock_dir = data_dir + "/container_mcd_lock"
        if self.lock_dir:
            verify_directory(self.lock_dir)
    

    You can replicate that exact error using this test code:

    class Foo(object):
        def __init__(self, lock_dir=None, data_dir=None):
            if lock_dir:
                self.lock_dir = lock_dir
            elif data_dir:
                self.lock_dir = data_dir + "/container_mcd_lock"
            if self.lock_dir:
                verify_directory(self.lock_dir)
    
    f = Foo()
    

    It turns out like this:

    >>> f = Foo()
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "<stdin>", line 7, in __init__
    AttributeError: 'Foo' object has no attribute 'lock_dir'
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a site that I'm using Mongo on. So far everything is going
I have a site in rails and want to have site-wide settings. One part
I want to have site wide default settings for all jQuery validation uses on
I have a site using a custom favicon.ico. The favicon displays as expected in
I have a site , and I want to prevent my users to log
My Scenario, Im using asp.net 2.0 .I have Site where it creates a unique
i have site that the user upload files (PDF,WORD,POWER POINT ....) and they want
I have site that I want to look like this: but instead it looks
I have a site built using jQuery and jQueryUI. All dialogs are using the
I have site with a members area that I've set up and want to

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.