-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add logging and handler for eof on server side (#25)
* add logging and handler for eof on server side (connection close probably) * edit info log
- Loading branch information
1 parent
34f61cd
commit b50d535
Showing
10 changed files
with
85 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
use memcrab_server::{serve, Cache}; | ||
use tokio::net::TcpListener; | ||
|
||
#[tokio::main] | ||
async fn main() { | ||
tracing_subscriber::fmt::init(); | ||
|
||
let one_gb = 2usize.pow(30); | ||
let cache = Cache::builder() | ||
.segments(10) | ||
.max_bytesize(one_gb) | ||
.build() | ||
.into(); | ||
|
||
let listener = TcpListener::bind("127.0.0.1:9900").await.unwrap(); | ||
serve(listener, cache).await.unwrap(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
mod readme; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
use memcrab::{connections::Tcp, Error, RawClient}; | ||
|
||
#[allow(dead_code)] | ||
async fn tcp_raw_client_readme() -> Result<(), Error> { | ||
let addr = "127.0.0.1:80".parse().unwrap(); | ||
let mut client = RawClient::<Tcp>::connect(addr).await?; | ||
|
||
client.set("date", vec![2, 3, 24]).await?; | ||
let name = client.get("name").await?; | ||
match name { | ||
Some(val) => println!("got {:?} from cache", val), | ||
None => println!("cache miss for name"), | ||
} | ||
Ok(()) | ||
} |