• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

uw-it-aca / uw-memcached-clients / 7787936268

05 Feb 2024 04:49PM UTC coverage: 96.959%. First build
7787936268

Pull #37

github

web-flow
Merge 7518ada84 into d5750476e
Pull Request #37: Develop

37 of 42 branches covered (0.0%)

Branch coverage included in aggregate %.

250 of 254 relevant lines covered (98.43%)

0.98 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

89.47
/memcached_clients/django_backend.py
1
# Copyright 2024 UW-IT, University of Washington
2
# SPDX-License-Identifier: Apache-2.0
3

4
from django.core.cache.backends.memcached import BaseMemcachedCache
1✔
5

6

7
class PymemcacheCache(BaseMemcachedCache):
1✔
8
    """
9
    Implementation of a pymemcache binding for Django 2.x.
10
    """
11
    def __init__(self, server, params):
1✔
12
        import pymemcache
1✔
13
        super().__init__(server, params, library=pymemcache,
1✔
14
                         value_not_found_exception=KeyError)
15

16
    @property
1✔
17
    def _cache(self):
1✔
18
        if getattr(self, "_client", None) is None:
1✔
19
            kwargs = {
1✔
20
                "allow_unicode_keys": True,
21
                "default_noreply": False,
22
                "serde": self._lib.serde.pickle_serde,
23
            }
24
            kwargs.update(self._options)
1✔
25
            self._client = self._lib.HashClient(self._servers, **kwargs)
1✔
26
        return self._client
1✔
27

28
    def close(self, **kwargs):
1✔
29
        # Don't call disconnect_all() if connection pooling is enabled,
30
        # as it resets the failover state and creates unnecessary reconnects.
31
        if not self._cache.use_pooling:
1!
32
            self._cache.disconnect_all()
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc