Skip to content

Instantly share code, notes, and snippets.

View greazleay's full-sized avatar

Lekan Adetunmbi greazleay

View GitHub Profile
@greazleay
greazleay / rest_client.go
Last active January 21, 2025 15:35
A http client wrapping the go-resty package, it simplifies making http requests while making components of requests (such as headers, parameters, query, body, authorization etc) flexible
package rest
import (
"fmt"
"time"
"github.com/go-resty/resty/v2"
)
type HttpRequest struct {
@greazleay
greazleay / app_cache.rs
Last active January 17, 2025 09:46
A reusable in-memory Rust cache written on top of the retainer crate, it allows you to insert a key as string and any type for the value with TTL for each insert
use std::{any::Any, hash::Hash, sync::Arc, time::Duration};
use retainer::Cache;
#[derive(Clone)]
pub struct AppCache {
cache: Arc<Cache<String, Box<dyn Any + Send + Sync>>>,
}
impl AppCache {

Keybase proof

I hereby claim:

  • I am greazleay on github.
  • I am greazleay (https://keybase.io/greazleay) on keybase.
  • I have a public key whose fingerprint is 8C40 8907 25DD EC73 A4F9 FC4C 1AEA CB98 AC81 03C9

To claim this, I am signing this object: