Skip to content

Commit d28cef3

Browse files
authored
Merge branch 'main' into replace-with-time
2 parents a4de37f + 176f774 commit d28cef3

File tree

3 files changed

+16
-7
lines changed

3 files changed

+16
-7
lines changed

.github/dependabot.yml

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "cargo"
4+
directory: "/"
5+
schedule:
6+
interval: "daily"

README.md

+3
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,15 @@
4646
* [async-sqlx-session](https://crates.io/crates/async-sqlx-session) postgres & sqlite
4747
* [async-redis-session](https://crates.io/crates/async-redis-session)
4848
* [async-mongodb-session](https://crates.io/crates/async-mongodb-session)
49+
* [async-session-r2d2](https://crates.io/crates/async-session-r2d2) - sqlite only
4950

5051
## Framework implementations
5152

5253
* [`tide::sessions`](https://docs.rs/tide/latest/tide/sessions/index.html)
5354
* [warp-sessions](https://docs.rs/warp-sessions/latest/warp_sessions/)
5455
* [trillium-sessions](https://docs.trillium.rs/trillium_sessions)
56+
* [axum-sessions](https://docs.rs/axum_sessions)
57+
* [salvo-sessions](https://docs.rs/salvo_extra/latest/salvo_extra/session/index.html)
5558

5659
## Safety
5760
This crate uses ``#![deny(unsafe_code)]`` to ensure everything is implemented in

src/session.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ use time::OffsetDateTime as DateTime;
2020
/// and read exactly once in order to set the cookie value.
2121
///
2222
/// ## Change tracking session tracks whether any of its inner data
23-
/// was changed since it was last serialized. Any sessoin store that
23+
/// was changed since it was last serialized. Any session store that
2424
/// does not undergo a serialization-deserialization cycle must call
2525
/// [`Session::reset_data_changed`] in order to reset the change tracker on
2626
/// an individual record.
@@ -157,7 +157,7 @@ impl Session {
157157
/// assert!(session.is_destroyed());
158158
/// # Ok(()) }) }
159159
pub fn destroy(&mut self) {
160-
self.destroy.store(true, Ordering::Relaxed);
160+
self.destroy.store(true, Ordering::SeqCst);
161161
}
162162

163163
/// returns true if this session is marked for destruction
@@ -174,7 +174,7 @@ impl Session {
174174
/// # Ok(()) }) }
175175
176176
pub fn is_destroyed(&self) -> bool {
177-
self.destroy.load(Ordering::Relaxed)
177+
self.destroy.load(Ordering::SeqCst)
178178
}
179179

180180
/// Gets the session id
@@ -230,7 +230,7 @@ impl Session {
230230
let mut data = self.data.write().unwrap();
231231
if data.get(key) != Some(&value) {
232232
data.insert(key.to_string(), value);
233-
self.data_changed.store(true, Ordering::Relaxed);
233+
self.data_changed.store(true, Ordering::Release);
234234
}
235235
}
236236

@@ -281,7 +281,7 @@ impl Session {
281281
pub fn remove(&mut self, key: &str) {
282282
let mut data = self.data.write().unwrap();
283283
if data.remove(key).is_some() {
284-
self.data_changed.store(true, Ordering::Relaxed);
284+
self.data_changed.store(true, Ordering::Release);
285285
}
286286
}
287287

@@ -479,7 +479,7 @@ impl Session {
479479
/// # Ok(()) }) }
480480
/// ```
481481
pub fn data_changed(&self) -> bool {
482-
self.data_changed.load(Ordering::Relaxed)
482+
self.data_changed.load(Ordering::Acquire)
483483
}
484484

485485
/// Resets `data_changed` dirty tracking. This is unnecessary for
@@ -503,7 +503,7 @@ impl Session {
503503
/// # Ok(()) }) }
504504
/// ```
505505
pub fn reset_data_changed(&self) {
506-
self.data_changed.store(false, Ordering::Relaxed);
506+
self.data_changed.store(false, Ordering::SeqCst);
507507
}
508508

509509
/// Ensures that this session is not expired. Returns None if it is expired

0 commit comments

Comments
 (0)