pymcache_fdw
Memcache foreign data wrapper for PostgreSQL written in python.
dependencies
installation
install python module
from sources (bitbucket)
$ git clone https://bitbucket.org/olshevskiy87/pymcache_fdw.git $ cd pymcache_fdw $ python setup.py installusing pip
$ pip install pymcache_fdw
create extension “multicorn”
$$ create extension multicorn;
create foreign server in database
foreign server to operate cache items
$$ CREATE SERVER pymcache_fdw FOREIGN DATA WRAPPER multicorn OPTIONS ( wrapper 'pymcache_fdw.PymcacheFDW' );foreign server to show statistics
$$ CREATE SERVER pymcache_fdw_stat FOREIGN DATA WRAPPER multicorn OPTIONS ( wrapper 'pymcache_fdw.PymcacheFDWStats' );
create foreign table
foreign table to operate cache items
$$ CREATE FOREIGN TABLE pymcache_test ( key TEXT, value TEXT, expire TEXT -- optional ) SERVER pymcache_fdw OPTIONS ( host 'localhost', port '11211', row_id 'key', expire '60' -- optional, default is 0 - never expire );foreign table to operate cache items with prefix in the keys
$$ CREATE FOREIGN TABLE pymcache_test_group ( key TEXT, value TEXT ) SERVER pymcache_fdw OPTIONS ( prefix 'group1_' );foreign table to show general-purpose statistics
$$ CREATE FOREIGN TABLE pymcache_stat_test ( stat_name TEXT, stat_value TEXT ) SERVER pymcache_fdw_stat;foreign table to show current memcache settings
$$ CREATE FOREIGN TABLE pymcache_stat_settings_test ( stat_name TEXT, stat_value TEXT ) SERVER pymcache_fdw_stat OPTIONS ( stats_cmd 'settings' );
usage
set cache item
$$ insert into pymcache_test(key, value)
values('meaning_of_life', '42');
INSERT 0 1
set cache item, that will expire after 10 seconds
$$ insert into pymcache_test(key, value, expire)
values('born_to_die', 'Lana Del Rey', 10);
INSERT 0 1
update cache item with key born_to_die
$$ update pymcache_test set value = 'Grand Funk Railroad', expire = 300 where key = 'born_to_die' UPDATE 1
get cache items with set of keys in “where” clause
$$ select key, value
from pymcache_test
where key in ('meaning_of_life', 'k1');
key | value
-----------------+-------
meaning_of_life | 42
(1 row)
delete cache item with key meaning_of_life
$$ delete from pymcache_test where key = 'meaning_of_life'; DELETE 1
set and get items with key prefix group1_
$$ insert into pymcache_test_group(key, value)
values('first_item', 'first value');
INSERT 0 1
$$ select key, value
from pymcache_test_group
where key = 'first_item';
key | value
------------+-------------
first_item | first value
(1 row)
show general-purpose statistics related to connections
$$ select stat_name, stat_value
from pymcache_stat_test
where stat_name ~* 'connection';
WARNING: Using default host: localhost
WARNING: Using default port: 11211
stat_name | stat_value
-----------------------+------------
curr_connections | 6
total_connections | 31
connection_structures | 7
(3 rows)
show “enabled” memcache settings
$$ select stat_name, stat_value
from pymcache_stat_settings_test
where stat_name ~* 'enabled';
stat_name | stat_value
-------------------+------------
cas_enabled | yes
auth_enabled_sasl | False
detail_enabled | no
flush_enabled | yes
(4 rows)
external links
Multicorn - postgres extension that allows to make FDW with python language
Memcached - distributed memory object caching system
Pymemcache - python module documentation
license
Copyright (c) 2016 Dmitriy Olshevskiy. MIT LICENSE.
See LICENSE.txt for details.
Metadata
Release files for pymcache-fdw 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| pymcache_fdw-0.2.0.tar.gz | 5.0 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pymcache_fdw-0.2.0-py2-none-any.whl | Python 2 | none | any | Details |
Total release size: 12.5 kB
Release files / pymcache_fdw-0.2.0.tar.gz
| Download URL | pymcache_fdw-0.2.0.tar.gz |
|---|---|
| Size | 5.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c0002e386b4a83f204c9b4abf449a44965982b2d80446a84d3fc2a265b8f3944
|
|
BLAKE2b-256 checksum How to use checksums |
dfae5d4f84fe139044d9b351c61c52ee04eab46b53eff976abe2d7c37ffe8df7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / pymcache_fdw-0.2.0-py2-none-any.whl
| Download URL | pymcache_fdw-0.2.0-py2-none-any.whl |
|---|---|
| Size | 7.5 kB |
| Tags | Python 2 |
|
SHA-256 checksum How to use checksums |
98f62acf88f7b55416d39cc3c2b193141271f2dff8779899fe9e0df5c6a97c2d
|
|
BLAKE2b-256 checksum How to use checksums |
2843ae6eb6970bea3914ae6ae06ca53c65e799a0bbfaaa4f1dfc487cc752806b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for pymcache-fdw 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.