Skip to content

tqwewe/lunatic-cached-process

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Cached process lookups with lunatic.

When a process is lookup, it is cached in the local process to avoid unnecessery future lookups. This is useful for globally registered processes and abstract processes.

Example

use lunatic::{spawn_link, Process};
use lunatic_cached_process::{cached_process, CachedLookup};

cached_process! {
    static COUNTER_PROCESS: Process<()> = "counter-process";
}

fn main() {
    let process = spawn_link!(|_mailbox: Mailbox<()>| { loop {} });
    process.register("counter-process");

    let lookup: Option<Process<()>> = COUNTER_PROCESS.get(); // First call lookup process from host
    assert!(lookup.is_some());

    let lookup: Option<Process<()>> = COUNTER_PROCESS.get(); // Subsequent calls will use cached process
    assert!(lookup.is_some());
}

For more examples, see the examples directory.

License

Licensed under either

at your option.

About

Cached process lookups with lunatic.

Topics

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Languages