Skip to content

Commit f358ef2

Browse files
committed
s/memcache/redis/g
1 parent 67980a2 commit f358ef2

File tree

5 files changed

+9
-9
lines changed

5 files changed

+9
-9
lines changed

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ vim local.env # update accordingly
5757
# MSC_WIS2NODE_MSC_DATAMART_AMQP: URL to MSC Datamart notification service
5858
# MSC_WIS2NODE_DISCOVERY_METADATA_ZIP: zipfile of MSC discovery metadata (file or URL)
5959
# MSC_WIS2NODE_TOPIC_PREFIX: base topic prefix for publication (i.e. origin/a/wis2/ca-eccc-msc)
60-
# MSC_WIS2NODE_CACHE: optional memcache instance
60+
# MSC_WIS2NODE_CACHE: optional redis instance
6161
# MSC_WIS2NODE_CACHE_EXPIRY_SECONDS: number of seconds for cache items to expire (default 86400 [1 day])
6262
# MSC_WIS2NODE_CENTRE_ID: centre identifier
6363
# MSC_WIS2NODE_WIS2_GDC: URL to a WIS2 GDC (default is Canada GDC)
@@ -85,7 +85,7 @@ msc-wis2node dataset delete-metadata --metadata-id 12345
8585

8686
The Docker setup uses Docker and Docker Compose to manage the following services:
8787

88-
- **msc-wis2node-cache**: memcache caching for data update detection (optional)
88+
- **msc-wis2node-cache**: redis instance for data update detection (optional)
8989
- **msc-wis2node-management**: management service to subscribe to MSC Datamart/HPFX and re-publish to WIS2
9090

9191
See [`msc-wis2node.env`](msc-wis2node.env) for default environment variable settings.

docker-compose.override.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,4 @@
2020
services:
2121
msc-wis2node-cache:
2222
ports:
23-
- 11211:11211
23+
- 6379:6379

docker-compose.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ x-logging: &logging
2828

2929
services:
3030
msc-wis2node-cache:
31-
image: memcached:latest
31+
image: redis:latest
3232
container_name: msc-wis2node-cache
3333
env_file:
3434
- msc-wis2node.env

msc-wis2node-management/msc_wis2node/publisher.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@
2727
import uuid
2828

2929
from paho.mqtt import publish
30-
from pymemcache.client import base as memcache_base
3130
from pywis_pubsub.publish import create_message
31+
import redis
3232
from sarracenia.flowcb import FlowCB
3333
import yaml
3434

@@ -83,7 +83,7 @@ def __init__(self):
8383
self.client_id = get_mqtt_client_id()
8484

8585
if CACHE is not None:
86-
self.cache = memcache_base.Client(CACHE)
86+
self.cache = redis.Redis().from_url(CACHE)
8787

8888
if BROKER_PORT == 8883:
8989
self.tls = get_mqtt_tls_settings()
@@ -191,8 +191,8 @@ def publish_to_wis2(self, dataset: dict, url: str) -> None:
191191
update_link['rel'] = 'update'
192192
message['links'].append(update_link)
193193
else:
194-
self.cache.set(message['properties']['data_id'],
195-
CACHE_EXPIRY_SECONDS)
194+
self.cache.set(message['properties']['data_id'], 'published',
195+
ex=CACHE_EXPIRY_SECONDS)
196196

197197
cache = dataset.get('cache', True)
198198
if not cache:

msc-wis2node-management/requirements.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ certifi
33
click
44
metpx-sr3
55
pywis-pubsub
6-
pymemcache
6+
redis[hiredis]

0 commit comments

Comments
 (0)