privex.helpers.plugin

This module handles connection objects for databases, APIs etc. by exposing functions which initialise and store class instances for re-use.

It’s primarily intended to be used to enable database, caching and third-party API connectivity for the helpers in this package, however, you’re free to use the functions / classes / attributes exposed in this module for your own apps.

Classes are generally initialised using the settings from settings - see the docs for that module to learn how to override the settings if the defaults don’t work for you.

Copyright:

    +===================================================+
    |                 © 2019 Privex Inc.                |
    |               https://www.privex.io               |
    +===================================================+
    |                                                   |
    |        Originally Developed by Privex Inc.        |
    |        License: X11 / MIT                         |
    |                                                   |
    |        Core Developer(s):                         |
    |                                                   |
    |          (+)  Chris (@someguy123) [Privex]        |
    |          (+)  Kale (@kryogenic) [Privex]          |
    |                                                   |
    +===================================================+

Copyright 2019     Privex Inc.   ( https://www.privex.io )

Functions

_get_all_threadstore([name])

Get the 'redis' key from every thread in the thread store.

_get_threadstore([name, fallback, thread_id])

_set_threadstore(name, obj[, thread_id])

clean_threadstore([thread_id, name, clean_all])

Remove the per-thread instance storage in __STORE, usually called when a thread is exiting.

close_memcached_async([thread_id, close_all])

Close the global Async Memcached connection and delete the instance.

close_redis([thread_id, close_all])

Close the global Redis connection and delete the instance.

close_redis_async([thread_id, close_all])

Close the global Async Redis connection and delete the instance.

configure_memcached_async([host, port])

Update global Memcached settings and re-instantiate the global Async Redis instance with the new settings.

configure_redis([host, port, db])

Update global Redis settings and re-instantiate the global Redis instance with the new settings.

configure_redis_async([host, port, db])

Update global Redis settings and re-instantiate the global Async Redis instance with the new settings.

connect_geoip(*args, **geo_config)

connect_memcached_async(**rd_config)

connect_redis(*args, **rd_config)

connect_redis_async(**rd_config)

get_geodbs()

get_geoip(geo_type[, new_connection, thread_id])

Get a GeoIP Reader object.

get_geoip_db(geo_type)

Return the full path to the GeoIP2 database for geo_type.

get_memcached_async([new_connection, thread_id])

Get an Async Memcached connection object.

get_redis([new_connection, thread_id])

Get a Redis connection object.

get_redis_async([new_connection, thread_id])

Get an Async Redis connection object.

reset_geoip(geo_type[, thread_id])

Close the global GeoIP connection, delete the instance, then re-instantiate it

reset_memcached_async([thread_id])

Close the global Async Memcached connection, delete the instance, then re-instantiate it

reset_redis([thread_id])

Close the global Redis connection, delete the instance, then re-instantiate it

reset_redis_async([thread_id])

Close the global Async Redis connection, delete the instance, then re-instantiate it