-
-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
improve: change cachedapi to use generic
- Loading branch information
Cheng JIANG
committed
Aug 30, 2020
1 parent
9c67ba4
commit c88f13c
Showing
5 changed files
with
16 additions
and
7 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[package] | ||
name = "casbin" | ||
version = "2.0.0" | ||
version = "2.0.1" | ||
authors = ["Joey <[email protected]>", "Cheng JIANG <[email protected]>"] | ||
edition = "2018" | ||
license = "Apache-2.0" | ||
|
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 |
---|---|---|
@@ -1,7 +1,13 @@ | ||
use crate::{cache::Cache, core_api::CoreApi}; | ||
|
||
pub trait CachedApi: CoreApi + Send + Sync { | ||
fn get_mut_cache(&mut self) -> &mut dyn Cache<u64, bool>; | ||
fn set_cache(&mut self, cache: Box<dyn Cache<u64, bool>>); | ||
use std::hash::Hash; | ||
|
||
pub trait CachedApi<K, V>: CoreApi + Send + Sync | ||
where | ||
K: Eq + Hash, | ||
V: Clone, | ||
{ | ||
fn get_mut_cache(&mut self) -> &mut dyn Cache<K, V>; | ||
fn set_cache(&mut self, cache: Box<dyn Cache<K, V>>); | ||
fn set_capacity(&mut self, cap: usize); | ||
} |
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
c88f13c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rust Benchmark
b_benchmark_abac_model
6252
ns/iter (± 870
)5447
ns/iter (± 867
)1.15
b_benchmark_basic_model
7092
ns/iter (± 624
)6216
ns/iter (± 1031
)1.14
b_benchmark_cached_abac_model
1275
ns/iter (± 132
)1149
ns/iter (± 268
)1.11
b_benchmark_cached_key_match
584
ns/iter (± 58
)567
ns/iter (± 139
)1.03
b_benchmark_cached_priority_model
615
ns/iter (± 68
)549
ns/iter (± 206
)1.12
b_benchmark_cached_rbac_model
620
ns/iter (± 79
)537
ns/iter (± 121
)1.15
b_benchmark_cached_rbac_model_large
555
ns/iter (± 65
)495
ns/iter (± 69
)1.12
b_benchmark_cached_rbac_model_medium
571
ns/iter (± 87
)551
ns/iter (± 102
)1.04
b_benchmark_cached_rbac_model_small
609
ns/iter (± 70
)576
ns/iter (± 111
)1.06
b_benchmark_cached_rbac_model_with_domains
861
ns/iter (± 76
)949
ns/iter (± 133
)0.91
b_benchmark_cached_rbac_with_deny
625
ns/iter (± 59
)587
ns/iter (± 92
)1.06
b_benchmark_cached_rbac_with_resource_roles
635
ns/iter (± 92
)595
ns/iter (± 83
)1.07
b_benchmark_key_match
26815
ns/iter (± 3878
)26783
ns/iter (± 3312
)1.00
b_benchmark_priority_model
8028
ns/iter (± 935
)7252
ns/iter (± 1353
)1.11
b_benchmark_raw
9
ns/iter (± 1
)7
ns/iter (± 1
)1.29
b_benchmark_rbac_model
10333
ns/iter (± 1139
)9933
ns/iter (± 1916
)1.04
b_benchmark_rbac_model_large
18775828
ns/iter (± 2707344
)18030250
ns/iter (± 2233963
)1.04
b_benchmark_rbac_model_medium
1927724
ns/iter (± 208258
)1822806
ns/iter (± 254048
)1.06
b_benchmark_rbac_model_small
181896
ns/iter (± 18082
)182270
ns/iter (± 38924
)1.00
b_benchmark_rbac_model_with_domains
10873
ns/iter (± 1445
)9898
ns/iter (± 2079
)1.10
b_benchmark_rbac_with_deny
14506
ns/iter (± 1869
)13323
ns/iter (± 2028
)1.09
b_benchmark_rbac_with_resource_roles
8366
ns/iter (± 960
)8019
ns/iter (± 2075
)1.04
b_benchmark_role_manager_large
8745189
ns/iter (± 999704
)8640797
ns/iter (± 1005575
)1.01
b_benchmark_role_manager_medium
809292
ns/iter (± 121665
)700620
ns/iter (± 107941
)1.16
b_benchmark_role_manager_small
87403
ns/iter (± 12381
)76701
ns/iter (± 15764
)1.14
b_benmark_cached_basic_model
633
ns/iter (± 92
)596
ns/iter (± 115
)1.06
This comment was automatically generated by workflow using github-action-benchmark.