pub struct Redis {
pub id: String,
pub memory: Option<String>,
pub eviction_policy: RedisEvictionPolicy,
pub persistence: bool,
pub high_availability: bool,
pub encryption_key: Option<ResourceRef>,
}Expand description
A managed, Redis-compatible in-memory store on a private network. The target platform decides the backend (AWS ElastiCache for Valkey, GCP Memorystore for Valkey, Azure Managed Redis, or the official Valkey image in Docker on Local). It is never publicly reachable, and it is a single endpoint (not cluster mode), so plain clients and multi-key scripts work.
Fields§
§id: String§memory: Option<String>Memory available for data (e.g. “512Mi”, “4Gi”). None = the smallest production tier. The smallest tier that fits is used; a request larger than the biggest single-shard tier on the platform is rejected.
eviction_policy: RedisEvictionPolicyWhat happens at the memory limit. Default volatile-lru: keys without
a TTL are never evicted.
persistence: boolKeep data across a server restart or maintenance. Default false (a
cache). On AWS, GCP and Azure this needs high_availability, because the
clouds only persist data from a replicated deployment. Local always
persists with an append-only file when this is on.
high_availability: boolOne replica in another zone with automatic failover. Default false.
encryption_key: Option<ResourceRef>Customer-managed key for encryption at rest. Cannot be changed after creation.
Implementations§
Source§impl Redis
impl Redis
Sourcepub fn new(id: String) -> RedisBuilder
pub fn new(id: String) -> RedisBuilder
Create an instance of Redis using the builder syntax
Source§impl Redis
impl Redis
Sourcepub const RESOURCE_TYPE: ResourceType
pub const RESOURCE_TYPE: ResourceType
The resource type identifier for Redis.
Sourcepub fn requested_memory_bytes(&self) -> Result<Option<u64>>
pub fn requested_memory_bytes(&self) -> Result<Option<u64>>
Requested memory in bytes, or None for the default tier. Uses the same parser as every other sized resource, so all controllers and emitters read a quantity the same way. A bare number is GiB (as for Postgres).
Sourcepub fn elasticache_node_type(&self) -> Result<(&'static str, u64)>
pub fn elasticache_node_type(&self) -> Result<(&'static str, u64)>
The smallest ElastiCache node type whose usable data memory fits the request, and
that usable memory in bytes. Usable memory is 75% of the node’s memory because
ElastiCache reserves 25% by default (reserved-memory-percent). With no request the
default is 1 GiB. Requests above the largest single-shard node are rejected, never capped.
Sourcepub fn memorystore_node_type(&self) -> Result<(&'static str, u64)>
pub fn memorystore_node_type(&self) -> Result<(&'static str, u64)>
The smallest Memorystore node type whose default usable memory fits the request, and that usable memory in bytes. With no request the default is 1 GiB. Requests above the largest node are rejected, never capped.
Sourcepub fn azure_managed_redis_sku(&self) -> Result<(&'static str, u64)>
pub fn azure_managed_redis_sku(&self) -> Result<(&'static str, u64)>
The smallest Azure Managed Redis SKU whose memory fits the request, and that memory in
bytes. With no request the default is 1 GiB. Requests above the largest NoCluster
SKU are rejected, never capped.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Redis
impl<'de> Deserialize<'de> for Redis
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for Redis
Source§impl ResourceDefinition for Redis
impl ResourceDefinition for Redis
Source§fn get_resource_type(&self) -> ResourceType
fn get_resource_type(&self) -> ResourceType
Source§fn replace_after_failed_create_is_safe(&self) -> bool
fn replace_after_failed_create_is_safe(&self) -> bool
Source§fn get_dependencies(&self) -> Vec<ResourceRef>
fn get_dependencies(&self) -> Vec<ResourceRef>
Source§fn validate_update(&self, new_config: &dyn ResourceDefinition) -> Result<()>
fn validate_update(&self, new_config: &dyn ResourceDefinition) -> Result<()>
Source§fn as_any_mut(&mut self) -> &mut dyn Any
fn as_any_mut(&mut self) -> &mut dyn Any
Source§fn box_clone(&self) -> Box<dyn ResourceDefinition>
fn box_clone(&self) -> Box<dyn ResourceDefinition>
Source§fn resource_eq(&self, other: &dyn ResourceDefinition) -> bool
fn resource_eq(&self, other: &dyn ResourceDefinition) -> bool
Source§fn to_json_value(&self) -> Result<Value>
fn to_json_value(&self) -> Result<Value>
impl StructuralPartialEq for Redis
Auto Trait Implementations§
impl Forget for Redis
impl Freeze for Redis
impl RefUnwindSafe for Redis
impl Send for Redis
impl Sync for Redis
impl Unpin for Redis
impl UnsafeUnpin for Redis
impl UnwindSafe for Redis
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.