Simple concurrent async get with expiration for Rust.

Build Status Latest Version

Docs

shared-expiry-get is a wrapper for accessing and caching a remote data source with some expiration criteria.

Features

shared-expiry-get does not:

Example Use Cases

A basic Example

```rust use failure::Error; use futures::future; use futures::future::IntoFuture; use futures::Future;

use sharedexpiryget::Expiry; use sharedexpiryget::Provider; use sharedexpiryget::RemoteStore;

[derive(Clone)]

struct MyProvider {}

[derive(Clone)]

struct Payload {}

impl Expiry for Payload { fn valid(&self) -> bool { true } }

impl Provider for MyProvider { fn update(&self) -> Box + Send> { Box::new(future::ok(Payload {}).into_future()) } }

fn main() { let rs = RemoteStore::new(MyProvider {}); let payload = rs.get().wait(); assert!(payload.is_ok()); } ```