Execute function on expiry #3

Closed
opened 4 years ago by janus · 2 comments
janus commented 4 years ago

I'd like to save the navigation history of the user to persistent storage once the session expires. I don't believe it is currently possible to execute a custom function on expiry. I am a bit unsure where I'd fit into the API.

I'd like to save the navigation history of the user to persistent storage once the session expires. I don't believe it is currently possible to execute a custom function on expiry. I am a bit unsure where I'd fit into the API.
Owner

Couldn't you do that in a custom Drop impl for your session object?

I'm not sure how you implement the persistence, if it's a file that will be OK, or if you need some database connection, something like Arc<Mutex<_>> in lazy_static could work

Couldn't you do that in a custom `Drop` impl for your session object? I'm not sure how you implement the persistence, if it's a file that will be OK, or if you need some database connection, something like `Arc<Mutex<_>>` in `lazy_static` could work
Poster

Ah, I hadn't thought about Drop. That's a great idea. Thanks so much for your reply :)

Ah, I hadn't thought about Drop. That's a great idea. Thanks so much for your reply :)
janus closed this issue 4 years ago
Sign in to join this conversation.
No Label
No Milestone
No Assignees
2 Participants
Notifications
Due Date

No due date set.

Dependencies

No dependencies set.

Reference: packages/rocket_session#3
Loading…
There is no content yet.