1
0
mirror of https://github.com/actix/actix-extras.git synced 2025-02-25 03:23:20 +01:00

Update docs for cache configuration

This commit is contained in:
James Eastham 2024-01-28 09:59:53 +00:00
parent 95e78861dc
commit 54e9de22a3
2 changed files with 68 additions and 15 deletions

View File

@ -7,11 +7,7 @@
<cargoProject FILE="$PROJECT_DIR$/Cargo.toml" /> <cargoProject FILE="$PROJECT_DIR$/Cargo.toml" />
</component> </component>
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="cb819d82-9f95-407f-a4e2-c022b965cd2d" name="Changes" comment=""> <list default="true" id="cb819d82-9f95-407f-a4e2-c022b965cd2d" name="Changes" comment="Fix tests" />
<change afterPath="$PROJECT_DIR$/src/storage/dynamo_db.rs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Cargo.toml" beforeDir="false" afterPath="$PROJECT_DIR$/Cargo.toml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/storage/mod.rs" beforeDir="false" afterPath="$PROJECT_DIR$/src/storage/mod.rs" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" /> <option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" /> <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
@ -41,17 +37,22 @@
<option name="hideEmptyMiddlePackages" value="true" /> <option name="hideEmptyMiddlePackages" value="true" />
<option name="showLibraryContents" value="true" /> <option name="showLibraryContents" value="true" />
</component> </component>
<component name="PropertiesComponent">{ <component name="PropertiesComponent"><![CDATA[{
&quot;keyToString&quot;: { "keyToString": {
&quot;RunOnceActivity.OpenProjectViewOnStart&quot;: &quot;true&quot;, "Cargo.Test actix-session.executor": "Run",
&quot;RunOnceActivity.ShowReadmeOnStart&quot;: &quot;true&quot;, "RunOnceActivity.OpenProjectViewOnStart": "true",
&quot;git-widget-placeholder&quot;: &quot;master&quot;, "RunOnceActivity.ShowReadmeOnStart": "true",
&quot;last_opened_file_path&quot;: &quot;/Users/jameseastham/source/github/actix-extras/actix-session&quot;, "git-widget-placeholder": "master",
&quot;nodejs_package_manager_path&quot;: &quot;npm&quot;, "last_opened_file_path": "/Users/jameseastham/source/github/actix-extras/actix-session",
&quot;org.rust.cargo.project.model.PROJECT_DISCOVERY&quot;: &quot;true&quot;, "node.js.detected.package.eslint": "true",
&quot;vue.rearranger.settings.migration&quot;: &quot;true&quot; "node.js.detected.package.tslint": "true",
"node.js.selected.package.eslint": "(autodetect)",
"node.js.selected.package.tslint": "(autodetect)",
"nodejs_package_manager_path": "npm",
"org.rust.cargo.project.model.PROJECT_DISCOVERY": "true",
"vue.rearranger.settings.migration": "true"
} }
}</component> }]]></component>
<component name="RunManager"> <component name="RunManager">
<configuration name="Test actix-session" type="CargoCommandRunConfiguration" factoryName="Cargo Command"> <configuration name="Test actix-session" type="CargoCommandRunConfiguration" factoryName="Cargo Command">
<option name="command" value="test --workspace" /> <option name="command" value="test --workspace" />
@ -85,10 +86,42 @@
<workItem from="1706382232373" duration="277000" /> <workItem from="1706382232373" duration="277000" />
<workItem from="1706382513749" duration="129000" /> <workItem from="1706382513749" duration="129000" />
<workItem from="1706382644812" duration="107000" /> <workItem from="1706382644812" duration="107000" />
<workItem from="1706382753760" duration="5701000" />
</task> </task>
<task id="LOCAL-00001" summary="Add DynamoDB implementation">
<option name="closed" value="true" />
<created>1706383632691</created>
<option name="number" value="00001" />
<option name="presentableId" value="LOCAL-00001" />
<option name="project" value="LOCAL" />
<updated>1706383632691</updated>
</task>
<task id="LOCAL-00002" summary="Fix CI build errors">
<option name="closed" value="true" />
<created>1706432853958</created>
<option name="number" value="00002" />
<option name="presentableId" value="LOCAL-00002" />
<option name="project" value="LOCAL" />
<updated>1706432853958</updated>
</task>
<task id="LOCAL-00003" summary="Fix tests">
<option name="closed" value="true" />
<created>1706435598339</created>
<option name="number" value="00003" />
<option name="presentableId" value="LOCAL-00003" />
<option name="project" value="LOCAL" />
<updated>1706435598339</updated>
</task>
<option name="localTasksCounter" value="4" />
<servers /> <servers />
</component> </component>
<component name="TypeScriptGeneratedFilesManager"> <component name="TypeScriptGeneratedFilesManager">
<option name="version" value="3" /> <option name="version" value="3" />
</component> </component>
<component name="VcsManagerConfiguration">
<MESSAGE value="Add DynamoDB implementation" />
<MESSAGE value="Fix CI build errors" />
<MESSAGE value="Fix tests" />
<option name="LAST_COMMIT_MESSAGE" value="Fix tests" />
</component>
</project> </project>

View File

@ -77,6 +77,10 @@ pub struct DynamoDbSessionStore {
client: Client, client: Client,
} }
/// Struct for configuring the DynamoDB Session Store. To add custom configuration, use the `DynamoDbSessionStoreBuilder`
///
/// [`DynamoDbSessionStoreBuilder`]: crate::storage::DynamoDbSessionStoreBuilder
#[derive(Clone)] #[derive(Clone)]
pub struct CacheConfiguration { pub struct CacheConfiguration {
cache_keygen: Arc<dyn Fn(&str) -> String + Send + Sync>, cache_keygen: Arc<dyn Fn(&str) -> String + Send + Sync>,
@ -92,6 +96,22 @@ pub struct CacheConfiguration {
} }
impl Default for CacheConfiguration { impl Default for CacheConfiguration {
/// Default values for the cache configuration
///
/// ```no_run
/// Self {
/// cache_keygen: Arc::new(str::to_owned),
/// table_name: "sessions".to_string(),
/// use_dynamo_db_local: false,
/// key_name: "SessionId".to_string(),
/// ttl_name: "session_ttl".to_string(),
/// session_data_name: "session_data".to_string(),
/// dynamo_db_local_endpoint: "http://localhost:8000".to_string(),
/// sdk_config: None,
/// region: None,
/// credentials: None,
/// }
/// ```
fn default() -> Self { fn default() -> Self {
Self { Self {
cache_keygen: Arc::new(str::to_owned), cache_keygen: Arc::new(str::to_owned),