Git Product home page Git Product logo

django-bmemcached's People

Contributors

alevy avatar edmorley avatar evansd avatar hugorodgerbrown avatar jaysonsantos avatar jezdez avatar jotes avatar saulshanabrook avatar vstoykov avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

django-bmemcached's Issues

`get_or_set()` returns a tuple when setting value

get_or_set() doesn't appear to work as expected.

When the key already exists it returns the value as expected. However when the key is being set, it will return a tuple of (value, _something). Similar seems to happen when calling cache.get() with a default.

I can't entirely follow whats happening but it looks like maybe the default is accidentally passed through to the get_cas param on the client.

Error on set_many with non-string values

When using set_many, if any of the values are non-strings, I get an error. I can loop through the set, and it works fine however. For example:

from django_bmemcached import BMemcached
client = BMemcached('127.0.0.1:11211', {})
client.set('single', 1)  # no error
client.set_many({'many': 1})  # struct.error: argument for 's' must be a bytes object
for key, value in {'many_loop': 1}.items():
    client.set(key, value)  # no error

My fix is to just do the loop, but would rather for performance use set_many. Happy to help if you can point me to the right place to fix.

Release schedule and other questions

  1. When do you plan to release to pypi next (or at least make a release tag)?
  2. Will django-bmemcached officially support Django 1.9 soon?
  3. Are there any known problems or bugs that I can help with right now (I see issue #1 is 4 years old)?

Problem if memcached server is down

Hi. I'm testing django-memcached in Heroku. But i have a problem today, because heroku memcached server go down. My app failed with exception below.

I try to catch this exception but i cant. Theres a way to avoid this behaviour ?

Thanks.

2011-12-11T17:23:49+00:00 app[web.1]: Traceback (most recent call last):
2011-12-11T17:23:49+00:00 app[web.1]: File "/app/lib/python2.7/site-packages/gunicorn/workers/sync.py", line 70, in handle
2011-12-11T17:23:49+00:00 app[web.1]: self.handle_request(req, client, addr)
2011-12-11T17:23:49+00:00 app[web.1]: File "/app/lib/python2.7/site-packages/gunicorn/workers/sync.py", line 96, in handle_request
2011-12-11T17:23:49+00:00 app[web.1]: respiter = self.wsgi(environ, resp.start_response)
2011-12-11T17:23:49+00:00 app[web.1]: File "/app/lib/python2.7/site-packages/django/contrib/staticfiles/handlers.py", line 68, in call
2011-12-11T17:23:49+00:00 app[web.1]: return self.application(environ, start_response)
2011-12-11T17:23:49+00:00 app[web.1]: File "/app/lib/python2.7/site-packages/django/core/handlers/wsgi.py", line 275, in call
2011-12-11T17:23:49+00:00 app[web.1]: signals.request_finished.send(sender=self.class)
2011-12-11T17:23:49+00:00 app[web.1]: File "/app/lib/python2.7/site-packages/django/dispatch/dispatcher.py", line 172, in send
2011-12-11T17:23:49+00:00 heroku[router]: Error H13 (Connection closed without response) -> POST l3b.herokuapp.com/tabBuilder/html/1/ dyno=web.1 queue= wait= service= status=503 bytes=
2011-12-11T17:23:49+00:00 app[web.1]: response = receiver(signal=self, sender=sender, *_named)
2011-12-11T17:23:49+00:00 app[web.1]: File "/app/lib/python2.7/site-packages/django/core/cache/backends/memcached.py", line 83, in close
2011-12-11T17:23:49+00:00 app[web.1]: self._cache.disconnect_all()
2011-12-11T17:23:49+00:00 app[web.1]: File "/app/lib/python2.7/site-packages/django_bmemcached/memcached.py", line 37, in _cache
2011-12-11T17:23:49+00:00 app[web.1]: self._options.get('password', None))
2011-12-11T17:23:49+00:00 app[web.1]: File "/app/lib/python2.7/site-packages/bmemcached/init.py", line 19, in init
2011-12-11T17:23:49+00:00 app[web.1]: self.set_servers(servers)
2011-12-11T17:23:49+00:00 app[web.1]: File "/app/lib/python2.7/site-packages/bmemcached/init.py", line 23, in set_servers
2011-12-11T17:23:49+00:00 app[web.1]: self.password) for server in servers]
2011-12-11T17:23:49+00:00 app[web.1]: File "/app/lib/python2.7/site-packages/bmemcached/init.py", line 147, in init
2011-12-11T17:23:49+00:00 app[web.1]: self.connection.connect((host, port))
2011-12-11T17:23:49+00:00 app[web.1]: File "/usr/local/lib/python2.7/socket.py", line 224, in meth
2011-12-11T17:23:49+00:00 app[web.1]: return getattr(self._sock,name)(_args)
2011-12-11T17:23:49+00:00 app[web.1]: error: [Errno 113] No route to host

Python 3 support

This package doesn't support python 3. It would be great if it did! Issue I'm hitting is with the relative vs. absolute import syntax in init.py.

Default value not returned for client.get

Im not sure if this is the right place for this issue tbh, as memcache in django involves lots of layers.

Djangos cache.get call usually respects default values, cache.get('non_existent_key', 'default_value') to give it a dict like experience when using.

Though that doesnt happen with this library, as https://github.com/jaysonsantos/python-binary-memcached/blob/master/bmemcached/client/replicating.py#L51 does not deal with default values in the get method.

I am using another very popular library (Django Rest Framework) that is failing because of this, see https://github.com/encode/django-rest-framework/blob/master/rest_framework/throttling.py#L123

As it expects the default value to be returned when the cache key is not present, but it never is.

If this issue has been raised in the wrong place, perhaps you could direct me to the right place ?

Thanks in advance

Nbr of open connections

Switching from django.core.cache.backends.memcached.MemcachedCache to django_bmemcached.memcached.BMemcached, we noticed the number of open connections to the database being used and to the cache memory increases significantly. (from 3 to > 30)

Is there a known reason for this and can It be changed?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.