mirror of
https://github.com/actix/actix-extras.git
synced 2024-11-24 07:53:00 +01:00
89 lines
23 KiB
HTML
89 lines
23 KiB
HTML
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="The interface to retrieve and save the current session data from/to the chosen storage backend."><title>SessionStore in actix_session::storage - Rust</title><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/SourceSerif4-Regular-46f98efaafac5295.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/FiraSans-Regular-018c141bf0843ffd.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/FiraSans-Medium-8f9a781e4970d388.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/SourceSerif4-Bold-a2c9cd1067f8b328.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2"><link rel="stylesheet" href="../../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../../static.files/rustdoc-deb46770fd761b69.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="actix_session" data-themes="" data-resource-suffix="" data-rustdoc-version="1.75.0-nightly (e20cb7702 2023-10-12)" data-channel="nightly" data-search-js="search-8fbf244ebcf71464.js" data-settings-js="settings-74424d7eec62a23e.js" ><script src="../../static.files/storage-fec3eaa3851e447d.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../static.files/main-5f34af1a0ee6bacd.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-5d8b3c7633ad77ba.css"></noscript><link rel="icon" href="https://actix.rs/favicon.ico"></head><body class="rustdoc trait"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle">☰</button><a class="logo-container" href="../../actix_session/index.html"><img src="https://actix.rs/img/logo.png" alt=""></a></nav><nav class="sidebar"><div class="sidebar-crate"><a class="logo-container" href="../../actix_session/index.html"><img src="https://actix.rs/img/logo.png" alt="logo"></a><h2><a href="../../actix_session/index.html">actix_session</a><span class="version">0.8.0</span></h2></div><h2 class="location"><a href="#">SessionStore</a></h2><div class="sidebar-elems"><section><h3><a href="#required-methods">Required Methods</a></h3><ul class="block"><li><a href="#tymethod.delete">delete</a></li><li><a href="#tymethod.load">load</a></li><li><a href="#tymethod.save">save</a></li><li><a href="#tymethod.update">update</a></li><li><a href="#tymethod.update_ttl">update_ttl</a></li></ul><h3><a href="#implementors">Implementors</a></h3></section><h2><a href="index.html">In actix_session::storage</a></h2></div></nav><main><div class="width-limiter"><nav class="sub"><form class="search-form"><span></span><input class="search-input" name="search" aria-label="Run search in the documentation" autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"><div id="help-button" title="help" tabindex="-1"><a href="../../help.html">?</a></div><div id="settings-menu" tabindex="-1"><a href="../../settings.html" title="settings"><img width="22" height="22" alt="Change settings" src="../../static.files/wheel-7b819b6101059cd0.svg"></a></div></form></nav><section id="main-content" class="content"><div class="main-heading"><h1>Trait <a href="../index.html">actix_session</a>::<wbr><a href="index.html">storage</a>::<wbr><a class="trait" href="#">SessionStore</a><button id="copy-path" title="Copy item path to clipboard"><img src="../../static.files/clipboard-7571035ce49a181d.svg" width="19" height="18" alt="Copy item path"></button></h1><span class="out-of-band"><a class="src" href="../../src/actix_session/storage/interface.rs.html#18-48">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>−</span>]</button></span></div><pre class="rust item-decl"><code>pub trait SessionStore {
|
||
// Required methods
|
||
fn <a href="#tymethod.load" class="fn">load</a><'life0, 'life1, 'async_trait>(
|
||
&'life0 self,
|
||
session_key: &'life1 <a class="struct" href="struct.SessionKey.html" title="struct actix_session::storage::SessionKey">SessionKey</a>
|
||
) -> <a class="struct" href="https://doc.rust-lang.org/nightly/core/pin/struct.Pin.html" title="struct core::pin::Pin">Pin</a><<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/boxed/struct.Box.html" title="struct alloc::boxed::Box">Box</a><dyn <a class="trait" href="https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html" title="trait core::future::future::Future">Future</a><Output = <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="https://doc.rust-lang.org/nightly/std/collections/hash/map/struct.HashMap.html" title="struct std::collections::hash::map::HashMap">HashMap</a><<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>>>, <a class="enum" href="enum.LoadError.html" title="enum actix_session::storage::LoadError">LoadError</a>>> + 'async_trait>>
|
||
<span class="where">where Self: 'async_trait,
|
||
'life0: 'async_trait,
|
||
'life1: 'async_trait</span>;
|
||
<span class="item-spacer"></span> fn <a href="#tymethod.save" class="fn">save</a><'life0, 'life1, 'async_trait>(
|
||
&'life0 self,
|
||
session_state: <a class="struct" href="https://doc.rust-lang.org/nightly/std/collections/hash/map/struct.HashMap.html" title="struct std::collections::hash::map::HashMap">HashMap</a><<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>>,
|
||
ttl: &'life1 Duration
|
||
) -> <a class="struct" href="https://doc.rust-lang.org/nightly/core/pin/struct.Pin.html" title="struct core::pin::Pin">Pin</a><<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/boxed/struct.Box.html" title="struct alloc::boxed::Box">Box</a><dyn <a class="trait" href="https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html" title="trait core::future::future::Future">Future</a><Output = <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="struct" href="struct.SessionKey.html" title="struct actix_session::storage::SessionKey">SessionKey</a>, <a class="enum" href="enum.SaveError.html" title="enum actix_session::storage::SaveError">SaveError</a>>> + 'async_trait>>
|
||
<span class="where">where Self: 'async_trait,
|
||
'life0: 'async_trait,
|
||
'life1: 'async_trait</span>;
|
||
<span class="item-spacer"></span> fn <a href="#tymethod.update" class="fn">update</a><'life0, 'life1, 'async_trait>(
|
||
&'life0 self,
|
||
session_key: <a class="struct" href="struct.SessionKey.html" title="struct actix_session::storage::SessionKey">SessionKey</a>,
|
||
session_state: <a class="struct" href="https://doc.rust-lang.org/nightly/std/collections/hash/map/struct.HashMap.html" title="struct std::collections::hash::map::HashMap">HashMap</a><<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>>,
|
||
ttl: &'life1 Duration
|
||
) -> <a class="struct" href="https://doc.rust-lang.org/nightly/core/pin/struct.Pin.html" title="struct core::pin::Pin">Pin</a><<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/boxed/struct.Box.html" title="struct alloc::boxed::Box">Box</a><dyn <a class="trait" href="https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html" title="trait core::future::future::Future">Future</a><Output = <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="struct" href="struct.SessionKey.html" title="struct actix_session::storage::SessionKey">SessionKey</a>, <a class="enum" href="enum.UpdateError.html" title="enum actix_session::storage::UpdateError">UpdateError</a>>> + 'async_trait>>
|
||
<span class="where">where Self: 'async_trait,
|
||
'life0: 'async_trait,
|
||
'life1: 'async_trait</span>;
|
||
<span class="item-spacer"></span> fn <a href="#tymethod.update_ttl" class="fn">update_ttl</a><'life0, 'life1, 'life2, 'async_trait>(
|
||
&'life0 self,
|
||
session_key: &'life1 <a class="struct" href="struct.SessionKey.html" title="struct actix_session::storage::SessionKey">SessionKey</a>,
|
||
ttl: &'life2 Duration
|
||
) -> <a class="struct" href="https://doc.rust-lang.org/nightly/core/pin/struct.Pin.html" title="struct core::pin::Pin">Pin</a><<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/boxed/struct.Box.html" title="struct alloc::boxed::Box">Box</a><dyn <a class="trait" href="https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html" title="trait core::future::future::Future">Future</a><Output = <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, <a class="struct" href="https://docs.rs/anyhow/1.0.75/anyhow/struct.Error.html" title="struct anyhow::Error">Error</a>>> + 'async_trait>>
|
||
<span class="where">where Self: 'async_trait,
|
||
'life0: 'async_trait,
|
||
'life1: 'async_trait,
|
||
'life2: 'async_trait</span>;
|
||
<span class="item-spacer"></span> fn <a href="#tymethod.delete" class="fn">delete</a><'life0, 'life1, 'async_trait>(
|
||
&'life0 self,
|
||
session_key: &'life1 <a class="struct" href="struct.SessionKey.html" title="struct actix_session::storage::SessionKey">SessionKey</a>
|
||
) -> <a class="struct" href="https://doc.rust-lang.org/nightly/core/pin/struct.Pin.html" title="struct core::pin::Pin">Pin</a><<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/boxed/struct.Box.html" title="struct alloc::boxed::Box">Box</a><dyn <a class="trait" href="https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html" title="trait core::future::future::Future">Future</a><Output = <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, <a class="struct" href="https://docs.rs/anyhow/1.0.75/anyhow/struct.Error.html" title="struct anyhow::Error">Error</a>>> + 'async_trait>>
|
||
<span class="where">where Self: 'async_trait,
|
||
'life0: 'async_trait,
|
||
'life1: 'async_trait</span>;
|
||
}</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>The interface to retrieve and save the current session data from/to the chosen storage backend.</p>
|
||
<p>You can provide your own custom session store backend by implementing this trait.</p>
|
||
<p><a href="https://docs.rs/async-trait"><code>async-trait</code></a> is used for this trait’s definition. Therefore, it
|
||
is required for implementations, too. In particular, we use the send-optional variant:
|
||
<code>#[async_trait(?Send)]</code>.</p>
|
||
</div></details><h2 id="required-methods" class="small-section-header">Required Methods<a href="#required-methods" class="anchor">§</a></h2><div class="methods"><details class="toggle method-toggle" open><summary><section id="tymethod.load" class="method"><a class="src rightside" href="../../src/actix_session/storage/interface.rs.html#20">source</a><h4 class="code-header">fn <a href="#tymethod.load" class="fn">load</a><'life0, 'life1, 'async_trait>(
|
||
&'life0 self,
|
||
session_key: &'life1 <a class="struct" href="struct.SessionKey.html" title="struct actix_session::storage::SessionKey">SessionKey</a>
|
||
) -> <a class="struct" href="https://doc.rust-lang.org/nightly/core/pin/struct.Pin.html" title="struct core::pin::Pin">Pin</a><<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/boxed/struct.Box.html" title="struct alloc::boxed::Box">Box</a><dyn <a class="trait" href="https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html" title="trait core::future::future::Future">Future</a><Output = <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="https://doc.rust-lang.org/nightly/std/collections/hash/map/struct.HashMap.html" title="struct std::collections::hash::map::HashMap">HashMap</a><<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>>>, <a class="enum" href="enum.LoadError.html" title="enum actix_session::storage::LoadError">LoadError</a>>> + 'async_trait>><span class="where fmt-newline">where
|
||
Self: 'async_trait,
|
||
'life0: 'async_trait,
|
||
'life1: 'async_trait,</span></h4></section></summary><div class="docblock"><p>Loads the session state associated to a session key.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="tymethod.save" class="method"><a class="src rightside" href="../../src/actix_session/storage/interface.rs.html#25-29">source</a><h4 class="code-header">fn <a href="#tymethod.save" class="fn">save</a><'life0, 'life1, 'async_trait>(
|
||
&'life0 self,
|
||
session_state: <a class="struct" href="https://doc.rust-lang.org/nightly/std/collections/hash/map/struct.HashMap.html" title="struct std::collections::hash::map::HashMap">HashMap</a><<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>>,
|
||
ttl: &'life1 Duration
|
||
) -> <a class="struct" href="https://doc.rust-lang.org/nightly/core/pin/struct.Pin.html" title="struct core::pin::Pin">Pin</a><<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/boxed/struct.Box.html" title="struct alloc::boxed::Box">Box</a><dyn <a class="trait" href="https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html" title="trait core::future::future::Future">Future</a><Output = <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="struct" href="struct.SessionKey.html" title="struct actix_session::storage::SessionKey">SessionKey</a>, <a class="enum" href="enum.SaveError.html" title="enum actix_session::storage::SaveError">SaveError</a>>> + 'async_trait>><span class="where fmt-newline">where
|
||
Self: 'async_trait,
|
||
'life0: 'async_trait,
|
||
'life1: 'async_trait,</span></h4></section></summary><div class="docblock"><p>Persist the session state for a newly created session.</p>
|
||
<p>Returns the corresponding session key.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="tymethod.update" class="method"><a class="src rightside" href="../../src/actix_session/storage/interface.rs.html#32-37">source</a><h4 class="code-header">fn <a href="#tymethod.update" class="fn">update</a><'life0, 'life1, 'async_trait>(
|
||
&'life0 self,
|
||
session_key: <a class="struct" href="struct.SessionKey.html" title="struct actix_session::storage::SessionKey">SessionKey</a>,
|
||
session_state: <a class="struct" href="https://doc.rust-lang.org/nightly/std/collections/hash/map/struct.HashMap.html" title="struct std::collections::hash::map::HashMap">HashMap</a><<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>>,
|
||
ttl: &'life1 Duration
|
||
) -> <a class="struct" href="https://doc.rust-lang.org/nightly/core/pin/struct.Pin.html" title="struct core::pin::Pin">Pin</a><<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/boxed/struct.Box.html" title="struct alloc::boxed::Box">Box</a><dyn <a class="trait" href="https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html" title="trait core::future::future::Future">Future</a><Output = <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="struct" href="struct.SessionKey.html" title="struct actix_session::storage::SessionKey">SessionKey</a>, <a class="enum" href="enum.UpdateError.html" title="enum actix_session::storage::UpdateError">UpdateError</a>>> + 'async_trait>><span class="where fmt-newline">where
|
||
Self: 'async_trait,
|
||
'life0: 'async_trait,
|
||
'life1: 'async_trait,</span></h4></section></summary><div class="docblock"><p>Updates the session state associated to a pre-existing session key.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="tymethod.update_ttl" class="method"><a class="src rightside" href="../../src/actix_session/storage/interface.rs.html#40-44">source</a><h4 class="code-header">fn <a href="#tymethod.update_ttl" class="fn">update_ttl</a><'life0, 'life1, 'life2, 'async_trait>(
|
||
&'life0 self,
|
||
session_key: &'life1 <a class="struct" href="struct.SessionKey.html" title="struct actix_session::storage::SessionKey">SessionKey</a>,
|
||
ttl: &'life2 Duration
|
||
) -> <a class="struct" href="https://doc.rust-lang.org/nightly/core/pin/struct.Pin.html" title="struct core::pin::Pin">Pin</a><<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/boxed/struct.Box.html" title="struct alloc::boxed::Box">Box</a><dyn <a class="trait" href="https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html" title="trait core::future::future::Future">Future</a><Output = <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, <a class="struct" href="https://docs.rs/anyhow/1.0.75/anyhow/struct.Error.html" title="struct anyhow::Error">Error</a>>> + 'async_trait>><span class="where fmt-newline">where
|
||
Self: 'async_trait,
|
||
'life0: 'async_trait,
|
||
'life1: 'async_trait,
|
||
'life2: 'async_trait,</span></h4></section></summary><div class="docblock"><p>Updates the TTL of the session state associated to a pre-existing session key.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="tymethod.delete" class="method"><a class="src rightside" href="../../src/actix_session/storage/interface.rs.html#47">source</a><h4 class="code-header">fn <a href="#tymethod.delete" class="fn">delete</a><'life0, 'life1, 'async_trait>(
|
||
&'life0 self,
|
||
session_key: &'life1 <a class="struct" href="struct.SessionKey.html" title="struct actix_session::storage::SessionKey">SessionKey</a>
|
||
) -> <a class="struct" href="https://doc.rust-lang.org/nightly/core/pin/struct.Pin.html" title="struct core::pin::Pin">Pin</a><<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/boxed/struct.Box.html" title="struct alloc::boxed::Box">Box</a><dyn <a class="trait" href="https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html" title="trait core::future::future::Future">Future</a><Output = <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, <a class="struct" href="https://docs.rs/anyhow/1.0.75/anyhow/struct.Error.html" title="struct anyhow::Error">Error</a>>> + 'async_trait>><span class="where fmt-newline">where
|
||
Self: 'async_trait,
|
||
'life0: 'async_trait,
|
||
'life1: 'async_trait,</span></h4></section></summary><div class="docblock"><p>Deletes a session from the store.</p>
|
||
</div></details></div><h2 id="implementors" class="small-section-header">Implementors<a href="#implementors" class="anchor">§</a></h2><div id="implementors-list"><section id="impl-SessionStore-for-CookieSessionStore" class="impl"><a class="src rightside" href="../../src/actix_session/storage/cookie.rs.html#55-99">source</a><a href="#impl-SessionStore-for-CookieSessionStore" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.SessionStore.html" title="trait actix_session::storage::SessionStore">SessionStore</a> for <a class="struct" href="struct.CookieSessionStore.html" title="struct actix_session::storage::CookieSessionStore">CookieSessionStore</a></h3></section><section id="impl-SessionStore-for-RedisActorSessionStore" class="impl"><a class="src rightside" href="../../src/actix_session/storage/redis_actor.rs.html#122-275">source</a><a href="#impl-SessionStore-for-RedisActorSessionStore" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.SessionStore.html" title="trait actix_session::storage::SessionStore">SessionStore</a> for <a class="struct" href="struct.RedisActorSessionStore.html" title="struct actix_session::storage::RedisActorSessionStore">RedisActorSessionStore</a></h3></section><section id="impl-SessionStore-for-RedisSessionStore" class="impl"><a class="src rightside" href="../../src/actix_session/storage/redis_rs.rs.html#136-248">source</a><a href="#impl-SessionStore-for-RedisSessionStore" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.SessionStore.html" title="trait actix_session::storage::SessionStore">SessionStore</a> for <a class="struct" href="struct.RedisSessionStore.html" title="struct actix_session::storage::RedisSessionStore">RedisSessionStore</a></h3></section></div><script src="../../implementors/actix_session/storage/interface/trait.SessionStore.js" async></script></section></div></main></body></html> |