Skip to content

module/mc.py

module.mc

MC

MC

Memcached cache

Source code in module/mc.py
class MC:  # pylint: disable=too-few-public-methods
    ''' Memcached cache '''
    @staticmethod
    def get_client() -> Client:
        ''' Get client

        - `binary`: `True`.
        - `behaviors`:
            - `tcp_nodelay`: `True`
            - `ketama`: `True`

        Returns:
            [pylibmc.Client][]

        '''
        return pylibmc.Client(setting.MC_SERVERS,
                              binary=True,
                              behaviors={'tcp_nodelay': True, 'ketama': True})

get_client staticmethod

get_client() -> Client

Get client

  • binary: True.
  • behaviors:
    • tcp_nodelay: True
    • ketama: True

Returns:

Type Description
Client

pylibmc.Client

Source code in module/mc.py
@staticmethod
def get_client() -> Client:
    ''' Get client

    - `binary`: `True`.
    - `behaviors`:
        - `tcp_nodelay`: `True`
        - `ketama`: `True`

    Returns:
        [pylibmc.Client][]

    '''
    return pylibmc.Client(setting.MC_SERVERS,
                          binary=True,
                          behaviors={'tcp_nodelay': True, 'ketama': True})