Accessing cache
Runnables can access an attached cache (such as Redis) using the cache namespace of the Runnable API. Atmo will configure the cache, and will bind it to the Runnable at runtime. Atmo provides a default in-memory cache if no external cache is connected.
Documentation for connecting an external cache to Atmo is coming soon.
For Rust, these methods are available under the cache module, for example cache::get(). For Swift, they are prefixed with Cache, for example Suborbital.CacheGet(). For TypeScript/AssemblyScript, they are prefixed with cache, for example import { cacheGet } from '@suborbital/suborbital'
The following namespace methods are available:

Set

Set a given key's value in the cache. The provided TTL is in seconds.
Rust:
1
pub fn set(key: &str, val: Vec<u8>, ttl: i32)
Copied!
AssemblyScript:
1
function cacheSet(key: string, value: ArrayBuffer, ttl: i32): void
Copied!
Swift:
1
public func CacheSet(key: String, value: String, ttl: Int)
Copied!

Get

Get the provided key from the cache.
Rust:
1
pub fn get(key: &str) -> Result<Vec<u8>, RunErr>
Copied!
AssemblyScript:
1
function cacheGet(key: string): ArrayBuffer
Copied!
Swift:
1
public func CacheGet(key: String) -> String
Copied!
Additional cache operations are coming soon.
Last modified 2mo ago
Export as PDF
Copy link
Contents
Set
Get