---
source: boltffi_bindgen/src/render/swift/templates.rs
assertion_line: 1765
expression: "render_class(&cls, \"boltffi\")"
---
public final class Cache {
    let handle: UnsafeMutableRawPointer

    init(handle: UnsafeMutableRawPointer) {
        self.handle = handle
    }

    deinit {
        boltffi_cache_free(handle)
    }

    public func get(key: String) -> CacheEntry? {
        var key = key
        return key.withUTF8 { keyBuf in
            guard let ptr = boltffi_cache_get(handle, keyBuf.baseAddress!, UInt(keyBuf.count)) else { return nil }
            return CacheEntry(handle: ptr)
        }
    }

}
