mirror of
https://github.com/cupcakearmy/cryptgeon.git
synced 2026-06-10 11:16:48 +00:00
Merge pull request #202 from smeinecke/update/redis-to-valkey
Replace Redis with Valkey in docker-compose files
This commit is contained in:
@@ -3,11 +3,11 @@
|
|||||||
|
|
||||||
services:
|
services:
|
||||||
redis:
|
redis:
|
||||||
image: redis:7-alpine
|
image: valkey/valkey:7-alpine
|
||||||
# This is required to stay in RAM only.
|
# This is required to stay in RAM only.
|
||||||
command: redis-server --save "" --appendonly no
|
command: valkey-server --save "" --appendonly no
|
||||||
# Set a size limit. See link below on how to customise.
|
# Set a size limit. See link below on how to customise.
|
||||||
# https://redis.io/docs/latest/operate/rs/databases/memory-performance/eviction-policy/
|
# https://valkey.io/docs/latest/operate/rs/databases/memory-performance/eviction-policy/
|
||||||
# --maxmemory 1gb --maxmemory-policy allkeys-lrulpine
|
# --maxmemory 1gb --maxmemory-policy allkeys-lrulpine
|
||||||
# This prevents the creation of an anonymous volume.
|
# This prevents the creation of an anonymous volume.
|
||||||
tmpfs:
|
tmpfs:
|
||||||
|
|||||||
+3
-3
@@ -1,10 +1,10 @@
|
|||||||
services:
|
services:
|
||||||
redis:
|
redis:
|
||||||
image: redis:7-alpine
|
image: valkey/valkey:7-alpine
|
||||||
# This is required to stay in RAM only.
|
# This is required to stay in RAM only.
|
||||||
command: redis-server --save "" --appendonly no
|
command: valkey-server --save "" --appendonly no
|
||||||
# Set a size limit. See link below on how to customise.
|
# Set a size limit. See link below on how to customise.
|
||||||
# https://redis.io/docs/latest/operate/rs/databases/memory-performance/eviction-policy/
|
# https://valkey.io/docs/latest/operate/rs/databases/memory-performance/eviction-policy/
|
||||||
# --maxmemory 1gb --maxmemory-policy allkeys-lrulpine
|
# --maxmemory 1gb --maxmemory-policy allkeys-lrulpine
|
||||||
# This prevents the creation of an anonymous volume.
|
# This prevents the creation of an anonymous volume.
|
||||||
tmpfs:
|
tmpfs:
|
||||||
|
|||||||
@@ -2,11 +2,11 @@ version: '3.8'
|
|||||||
|
|
||||||
services:
|
services:
|
||||||
redis:
|
redis:
|
||||||
image: redis:7-alpine
|
image: valkey/valkey:7-alpine
|
||||||
# This is required to stay in RAM only.
|
# This is required to stay in RAM only.
|
||||||
command: redis-server --save "" --appendonly no
|
command: valkey-server --save "" --appendonly no
|
||||||
# Set a size limit. See link below on how to customise.
|
# Set a size limit. See link below on how to customise.
|
||||||
# https://redis.io/docs/latest/operate/rs/databases/memory-performance/eviction-policy/
|
# https://valkey.io/docs/latest/operate/rs/databases/memory-performance/eviction-policy/
|
||||||
# --maxmemory 1gb --maxmemory-policy allkeys-lrulpine
|
# --maxmemory 1gb --maxmemory-policy allkeys-lrulpine
|
||||||
# This prevents the creation of an anonymous volume.
|
# This prevents the creation of an anonymous volume.
|
||||||
tmpfs:
|
tmpfs:
|
||||||
|
|||||||
@@ -108,11 +108,11 @@ networks:
|
|||||||
|
|
||||||
services:
|
services:
|
||||||
redis:
|
redis:
|
||||||
image: redis:7-alpine
|
image: valkey/valkey:7-alpine
|
||||||
# This is required to stay in RAM only.
|
# This is required to stay in RAM only.
|
||||||
command: redis-server --save "" --appendonly no
|
command: valkey-server --save "" --appendonly no
|
||||||
# Set a size limit. See link below on how to customise.
|
# Set a size limit. See link below on how to customise.
|
||||||
# https://redis.io/docs/latest/operate/rs/databases/memory-performance/eviction-policy/
|
# https://valkey.io/docs/latest/operate/rs/databases/memory-performance/eviction-policy/
|
||||||
# --maxmemory 1gb --maxmemory-policy allkeys-lrulpine
|
# --maxmemory 1gb --maxmemory-policy allkeys-lrulpine
|
||||||
# This prevents the creation of an anonymous volume.
|
# This prevents the creation of an anonymous volume.
|
||||||
tmpfs:
|
tmpfs:
|
||||||
|
|||||||
@@ -17,11 +17,11 @@ networks:
|
|||||||
|
|
||||||
services:
|
services:
|
||||||
redis:
|
redis:
|
||||||
image: redis:7-alpine
|
image: valkey/valkey:7-alpine
|
||||||
# This is required to stay in RAM only.
|
# This is required to stay in RAM only.
|
||||||
command: redis-server --save "" --appendonly no
|
command: valkey-server --save "" --appendonly no
|
||||||
# Set a size limit. See link below on how to customise.
|
# Set a size limit. See link below on how to customise.
|
||||||
# https://redis.io/docs/latest/operate/rs/databases/memory-performance/eviction-policy/
|
# https://valkey.io/docs/latest/operate/rs/databases/memory-performance/eviction-policy/
|
||||||
# --maxmemory 1gb --maxmemory-policy allkeys-lrulpine
|
# --maxmemory 1gb --maxmemory-policy allkeys-lrulpine
|
||||||
# This prevents the creation of an anonymous volume.
|
# This prevents the creation of an anonymous volume.
|
||||||
tmpfs:
|
tmpfs:
|
||||||
@@ -61,11 +61,11 @@ services:
|
|||||||
- "/var/run/docker.sock:/var/run/docker.sock:ro"
|
- "/var/run/docker.sock:/var/run/docker.sock:ro"
|
||||||
|
|
||||||
redis:
|
redis:
|
||||||
image: redis:7-alpine
|
image: valkey/valkey:7-alpine
|
||||||
# This is required to stay in RAM only.
|
# This is required to stay in RAM only.
|
||||||
command: redis-server --save "" --appendonly no
|
command: valkey-server --save "" --appendonly no
|
||||||
# Set a size limit. See link below on how to customise.
|
# Set a size limit. See link below on how to customise.
|
||||||
# https://redis.io/docs/latest/operate/rs/databases/memory-performance/eviction-policy/
|
# https://valkey.io/docs/latest/operate/rs/databases/memory-performance/eviction-policy/
|
||||||
# --maxmemory 1gb --maxmemory-policy allkeys-lrulpine
|
# --maxmemory 1gb --maxmemory-policy allkeys-lrulpine
|
||||||
# This prevents the creation of an anonymous volume.
|
# This prevents the creation of an anonymous volume.
|
||||||
tmpfs:
|
tmpfs:
|
||||||
|
|||||||
@@ -31,13 +31,13 @@ pub fn set(id: &String, note: &Note) -> Result<(), &'static str> {
|
|||||||
let serialized = serde_json::to_string(¬e.clone()).unwrap();
|
let serialized = serde_json::to_string(¬e.clone()).unwrap();
|
||||||
let mut conn = get_connection()?;
|
let mut conn = get_connection()?;
|
||||||
|
|
||||||
conn.set(id, serialized)
|
conn.set::<_, _, ()>(id, serialized)
|
||||||
.map_err(|_| "Unable to set note in redis")?;
|
.map_err(|_| "Unable to set note in redis")?;
|
||||||
match note.expiration {
|
match note.expiration {
|
||||||
Some(e) => {
|
Some(e) => {
|
||||||
let seconds = e - now();
|
let seconds = e - now();
|
||||||
conn.expire(id, seconds as i64)
|
conn.expire::<_, ()>(id, seconds as i64)
|
||||||
.map_err(|_| "Unable to set expiration on notion")?
|
.map_err(|_| "Unable to set expiration on note")?
|
||||||
}
|
}
|
||||||
None => {}
|
None => {}
|
||||||
};
|
};
|
||||||
@@ -58,6 +58,6 @@ pub fn get(id: &String) -> Result<Option<Note>, &'static str> {
|
|||||||
|
|
||||||
pub fn del(id: &String) -> Result<(), &'static str> {
|
pub fn del(id: &String) -> Result<(), &'static str> {
|
||||||
let mut conn = get_connection()?;
|
let mut conn = get_connection()?;
|
||||||
conn.del(id).map_err(|_| "Unable to delete note in redis")?;
|
conn.del::<_, ()>(id).map_err(|_| "Unable to delete note in redis")?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user