surrealdb-core 2.7.0

A scalable, distributed, collaborative, document-graph database, for the realtime web
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use crate::idg::u32::U32;
use std::collections::HashMap;

#[derive(Default)]
pub(super) struct Stash(pub HashMap<Vec<u8>, U32>);

impl Stash {
	/// Set a key in the cache
	pub fn set(&mut self, key: Vec<u8>, val: U32) {
		self.0.insert(key, val);
	}
	/// Get a key from the cache
	pub fn get(&mut self, key: &[u8]) -> Option<U32> {
		self.0.get(key).cloned()
	}
}