stored_session 0.2.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/CHANGELOG.md +11 -1
- data/README.md +18 -12
- data/app/jobs/stored_session/expire_sessions_job.rb +9 -0
- data/app/models/stored_session/session.rb +2 -37
- data/lib/stored_session/configuration.rb +6 -8
- data/lib/stored_session/log_subscriber.rb +38 -0
- data/lib/stored_session/model.rb +48 -0
- data/lib/stored_session/store/instrumentation.rb +12 -5
- data/lib/stored_session/store/logging.rb +23 -0
- data/lib/stored_session/store.rb +13 -29
- data/lib/stored_session/version.rb +20 -1
- data/lib/tasks/stored_session_tasks.rake +11 -0
- data.tar.gz.sig +0 -0
- metadata +15 -14
- metadata.gz.sig +0 -0
- data/app/jobs/stored_session/trim_sessions_job.rb +0 -9
- data/lib/stored_session/gem_version.rb +0 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0fdc7320b5869cf417a6f35aca5177abe2c45443962df8331dfffbd069a245c0
|
4
|
+
data.tar.gz: 0634dc8376279d46db4c4be0914dcc15e60eaad5d6b5a39d8962ccdff4cbf91d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5c515410928dbca10c0ef9f6392bfa8b808cd5371ffd14eee0ebb04c49ce29cf01b9feaabd125c77c158f82e31e75256689bb26c298900561ee27d8384209877
|
7
|
+
data.tar.gz: eca89926f65686e00f9d6f7de2e968e8aff0dfc1b1d672caf50ea46438b7474a1f5e554fb75fc746d84a700a6167d719b619543b7b1a4c717af6ec00683c8c21
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/CHANGELOG.md
CHANGED
@@ -1,7 +1,17 @@
|
|
1
|
-
#
|
1
|
+
# Stored Session Changelog
|
2
2
|
|
3
3
|
## Unreleased
|
4
4
|
|
5
|
+
## [0.4.0](https://github.com/tbhb/stored_session/releases/tag/v0.4.0)
|
6
|
+
|
7
|
+
- Update minimum Rails version to 8.0.0 (<https://github.com/tbhb/stored_session/pull/47>)
|
8
|
+
|
9
|
+
## [0.3.0](https://github.com/tbhb/stored_session/releases/tag/v0.3.0)
|
10
|
+
|
11
|
+
- Add log subscriber events (<https://github.com/tbhb/stored_session/pull/22>)
|
12
|
+
- Extract session model behavior into concern (<https://github.com/tbhb/stored_session/pull/24>)
|
13
|
+
- Rename trim to expire and add Rake tasks (<https://github.com/tbhb/stored_session/pull/27>)
|
14
|
+
|
5
15
|
## [0.2.0](https://github.com/tbhb/stored_session/releases/tag/v0.2.0)
|
6
16
|
|
7
17
|
- Rename gem to `stored_session` (<https://github.com/tbhb/stored_session/pull/19>)
|
data/README.md
CHANGED
@@ -1,27 +1,33 @@
|
|
1
1
|
# Stored Session
|
2
2
|
|
3
|
+
[](https://badge.fury.io/rb/stored_session) [](https://www.ruby-lang.org/en/downloads/) [](https://edgeguides.rubyonrails.org/) [](https://github.com/tbhb/stored_session/actions/workflows/ci.yml) [](https://opensource.org/licenses/MIT)
|
4
|
+
|
3
5
|
Encrypted, database-backed [session store](https://guides.rubyonrails.org/security.html#session-storage) for [Rails](https://rubyonrails.org). It is a modernization of the [activerecord-session_store](https://github.com/rails/activerecord-session_store) gem that was previously extracted from Rails. Stored Session is encrypted by default and is tested with MySQL, PostgreSQL, and SQLite against Rails 8+.
|
4
6
|
|
5
7
|
> [!WARNING]
|
6
|
-
> This gem is currently in active development and should be considered alpha software. The API and functionality are subject to change without notice until a stable 1.0 release.
|
8
|
+
> This gem is currently in active development and should be considered alpha software. The API and functionality are subject to change without notice until a stable 1.0 release. See the [roadmap](https://github.com/users/tbhb/projects/6/views/1) for more details.
|
7
9
|
|
8
|
-
## Features
|
10
|
+
## Features
|
9
11
|
|
10
12
|
- [x] Compact, encrypted serialization with [MessagePack](https://msgpack.org/) (inspired by [Solid Cache](https://github.com/rails/solid_cache))
|
11
|
-
- [x] Built-in
|
13
|
+
- [x] Built-in job for expiring inactive sessions
|
12
14
|
- [x] Tested with MySQL, PostgreSQL, and SQLite
|
13
15
|
- [x] Instrumentation with [ActiveSupport::Notifications](https://guides.rubyonrails.org/active_support_instrumentation.html)
|
14
|
-
- [ ]
|
15
|
-
- [ ]
|
16
|
+
- [ ] Privacy-friendly, indexed session metadata (IP, user agent, geocoding)
|
17
|
+
- [ ] Callbacks for session operations
|
18
|
+
- [ ] Session statistics
|
16
19
|
- [ ] Support for dedicated sessions database
|
17
|
-
- [ ]
|
18
|
-
- [ ]
|
19
|
-
- [ ]
|
20
|
+
- [ ] Testing framework helpers
|
21
|
+
- [ ] Installation generator
|
22
|
+
- [ ] Full demo application
|
23
|
+
- [ ] `stored_session_web` gem for monitoring and maintenance
|
24
|
+
|
25
|
+
See [the roadmap](https://github.com/users/tbhb/projects/6/views/1) for the complete list of planned and in-progress features.
|
20
26
|
|
21
27
|
## Prerequisites
|
22
28
|
|
23
29
|
- Ruby >= 3.2.0
|
24
|
-
- Rails >= 8.0.0
|
30
|
+
- Rails >= 8.0.0
|
25
31
|
|
26
32
|
## Installation
|
27
33
|
|
@@ -39,12 +45,12 @@ Then, set your session store in `config/initializers/session_store.rb`:
|
|
39
45
|
Rails.application.config.session_store :stored_session_store, key: '_my_app_session`
|
40
46
|
```
|
41
47
|
|
42
|
-
When [Solid Queue](https://github.com/rails/solid_queue) is used as your ActiveJob queue adapter, add `StoredSession::
|
48
|
+
When [Solid Queue](https://github.com/rails/solid_queue) is used as your ActiveJob queue adapter, add `StoredSession::ExpireSessionsJob` to `config/recurring.yml`:
|
43
49
|
|
44
50
|
```ruby
|
45
51
|
production:
|
46
|
-
|
47
|
-
class: "StoredSession::
|
52
|
+
expire_sessions:
|
53
|
+
class: "StoredSession::ExpireSessionsJob"
|
48
54
|
schedule: every day
|
49
55
|
```
|
50
56
|
|
@@ -0,0 +1,9 @@
|
|
1
|
+
class StoredSession::ExpireSessionsJob < StoredSession.config.base_job_class
|
2
|
+
queue_as StoredSession.config.expire_sessions_job_queue_as
|
3
|
+
|
4
|
+
def perform(max_created_age: nil, max_updated_age: nil)
|
5
|
+
StoredSession::Session.expire(max_created_age:, max_updated_age:)
|
6
|
+
end
|
7
|
+
|
8
|
+
ActiveSupport.run_load_hooks(:stored_session_expire_sessions_job, self)
|
9
|
+
end
|
@@ -1,44 +1,9 @@
|
|
1
1
|
require "active_support/core_ext/integer/time"
|
2
2
|
|
3
3
|
class StoredSession::Session < StoredSession::Record
|
4
|
-
|
5
|
-
|
6
|
-
serialize :data, coder: ActiveSupport::MessagePack, type: Hash
|
7
|
-
encrypts :data, message_serializer: ActiveRecord::Encryption::MessagePackMessageSerializer.new
|
8
|
-
|
9
|
-
scope :by_sid, ->(sid) { where(sid: sid) }
|
10
|
-
|
11
|
-
class << self
|
12
|
-
def read(sid)
|
13
|
-
without_query_cache do
|
14
|
-
select(:data).find_by(sid: sid)&.data
|
15
|
-
end
|
16
|
-
end
|
4
|
+
include StoredSession::Model
|
17
5
|
|
18
|
-
|
19
|
-
without_query_cache do
|
20
|
-
upsert({ sid:, data: }, unique_by: upsert_unique_by, on_duplicate: :update, update_only: %i[sid data])
|
21
|
-
end
|
22
|
-
true
|
23
|
-
rescue ActiveRecord::SerializationTypeMismatch
|
24
|
-
false
|
25
|
-
end
|
26
|
-
|
27
|
-
def trim!(max_created_age: nil, max_updated_age: nil)
|
28
|
-
max_created_threshold = (max_created_age || StoredSession.config.max_created_age).ago
|
29
|
-
max_updated_threshold = (max_updated_age || StoredSession.config.max_updated_age).ago
|
30
|
-
where(created_at: ...max_created_threshold).or(where(updated_at: ...max_updated_threshold)).in_batches.delete_all
|
31
|
-
end
|
32
|
-
|
33
|
-
private
|
34
|
-
def upsert_unique_by
|
35
|
-
connection.supports_insert_conflict_target? ? :sid : nil
|
36
|
-
end
|
37
|
-
|
38
|
-
def without_query_cache(&)
|
39
|
-
uncached(dirties: false, &)
|
40
|
-
end
|
41
|
-
end
|
6
|
+
self.table_name = StoredSession.config.sessions_table_name
|
42
7
|
|
43
8
|
ActiveSupport.run_load_hooks(:stored_session_session, self)
|
44
9
|
end
|
@@ -7,14 +7,13 @@ class StoredSession::Configuration
|
|
7
7
|
attribute :base_record_class_name, :string, default: "::ApplicationRecord"
|
8
8
|
|
9
9
|
attribute :connects_to
|
10
|
-
attribute :max_created_age, default: 30.days
|
11
|
-
attribute :max_updated_age, default: 30.days
|
12
10
|
|
13
11
|
attribute :sessions_table_name, :string, default: "stored_sessions"
|
14
12
|
attribute :session_class_name, :string, default: "::StoredSession::Session"
|
13
|
+
attribute :session_max_created_age, default: 30.days
|
14
|
+
attribute :session_max_updated_age, default: 30.days
|
15
15
|
|
16
|
-
attribute :
|
17
|
-
attribute :trim_sessions_job_queue_as, default: :default
|
16
|
+
attribute :expire_sessions_job_queue_as, default: :default
|
18
17
|
|
19
18
|
validates :base_controller_class_name, presence: true
|
20
19
|
validates :base_job_class_name, presence: true
|
@@ -22,11 +21,10 @@ class StoredSession::Configuration
|
|
22
21
|
|
23
22
|
validates :sessions_table_name, presence: true
|
24
23
|
validates :session_class_name, presence: true
|
24
|
+
validates :session_max_created_age, numericality: { greater_than: 0 }, presence: true
|
25
|
+
validates :session_max_updated_age, numericality: { greater_than: 0 }, presence: true
|
25
26
|
|
26
|
-
validates :
|
27
|
-
validates :max_updated_age, numericality: { greater_than: 0 }, presence: true
|
28
|
-
|
29
|
-
validates :trim_sessions_job_queue_as, presence: true
|
27
|
+
validates :expire_sessions_job_queue_as, presence: true
|
30
28
|
|
31
29
|
def base_controller_class = base_controller_class_name.constantize
|
32
30
|
def base_job_class = base_job_class_name.constantize
|
@@ -1,2 +1,40 @@
|
|
1
1
|
class StoredSession::LogSubscriber < ActiveSupport::LogSubscriber
|
2
|
+
def initialize
|
3
|
+
super
|
4
|
+
@logger = logger || StoredSession.logger
|
5
|
+
end
|
6
|
+
|
7
|
+
attr_writer :logger
|
8
|
+
|
9
|
+
def logger
|
10
|
+
@logger ||= StoredSession.logger
|
11
|
+
end
|
12
|
+
|
13
|
+
def session_read(event)
|
14
|
+
debug formatted_event(event, "Session Read", **event.payload.slice(:sid))
|
15
|
+
end
|
16
|
+
subscribe_log_level :session_read, :debug
|
17
|
+
|
18
|
+
def session_write(event)
|
19
|
+
debug formatted_event(event, "Session Write", **event.payload.slice(:sid))
|
20
|
+
end
|
21
|
+
subscribe_log_level :session_write, :debug
|
22
|
+
|
23
|
+
def session_delete(event)
|
24
|
+
debug formatted_event(event, "Session Delete", **event.payload.slice(:sid))
|
25
|
+
end
|
26
|
+
subscribe_log_level :session_delete, :debug
|
27
|
+
|
28
|
+
private
|
29
|
+
def formatted_event(event, operation, **)
|
30
|
+
" [StoredSession] #{operation} in #{formatted_duration(event)} (#{formatted_payload(**)})"
|
31
|
+
end
|
32
|
+
|
33
|
+
def formatted_duration(event)
|
34
|
+
"%.1fms" % event.duration
|
35
|
+
end
|
36
|
+
|
37
|
+
def formatted_payload(**attributes)
|
38
|
+
attributes.map { |k, v| "#{k}: #{v.inspect}" }.join(" | ")
|
39
|
+
end
|
2
40
|
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
module StoredSession::Model
|
2
|
+
extend ActiveSupport::Concern
|
3
|
+
|
4
|
+
included do
|
5
|
+
serialize :data, coder: ActiveSupport::MessagePack, type: Hash
|
6
|
+
encrypts :data, message_serializer: ActiveRecord::Encryption::MessagePackMessageSerializer.new
|
7
|
+
|
8
|
+
scope :by_sid, ->(sid) { where(sid: sid) }
|
9
|
+
end
|
10
|
+
|
11
|
+
module ClassMethods
|
12
|
+
def read(sid)
|
13
|
+
without_query_cache do
|
14
|
+
select(:data).find_by(sid: sid)&.data
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def write(sid, data)
|
19
|
+
without_query_cache do
|
20
|
+
upsert({ sid:, data: }, unique_by: upsert_unique_by, on_duplicate: :update, update_only: %i[sid data])
|
21
|
+
end
|
22
|
+
true
|
23
|
+
rescue ActiveRecord::SerializationTypeMismatch
|
24
|
+
false
|
25
|
+
end
|
26
|
+
|
27
|
+
def expire(max_created_age: nil, max_updated_age: nil)
|
28
|
+
max_created_threshold = (max_created_age || StoredSession.config.session_max_created_age).ago
|
29
|
+
max_updated_threshold = (max_updated_age || StoredSession.config.session_max_updated_age).ago
|
30
|
+
where(created_at: ...max_created_threshold).or(where(updated_at: ...max_updated_threshold)).in_batches.delete_all
|
31
|
+
end
|
32
|
+
|
33
|
+
def expire_later(max_created_age: nil, max_updated_age: nil)
|
34
|
+
StoredSession::ExpireSessionsJob.perform_later(max_created_age: max_created_age, max_updated_age: max_updated_age)
|
35
|
+
end
|
36
|
+
|
37
|
+
private
|
38
|
+
def upsert_unique_by
|
39
|
+
connection.supports_insert_conflict_target? ? :sid : nil
|
40
|
+
end
|
41
|
+
|
42
|
+
def without_query_cache(&)
|
43
|
+
uncached(dirties: false, &)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
ActiveSupport.run_load_hooks(:stored_session_model, self)
|
48
|
+
end
|
@@ -1,14 +1,21 @@
|
|
1
|
+
require_relative "logging"
|
2
|
+
|
1
3
|
module StoredSession
|
2
4
|
class Store < ActionDispatch::Session::AbstractSecureStore
|
3
5
|
module Instrumentation
|
4
6
|
extend ActiveSupport::Concern
|
5
7
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
8
|
+
include StoredSession::Store::Logging
|
9
|
+
|
10
|
+
private
|
11
|
+
def instrument(operation, sid, **options, &blk)
|
12
|
+
silence do
|
13
|
+
payload = { sid: sid&.private_id, **options }
|
14
|
+
ActiveSupport::Notifications.instrument("session_#{operation}.stored_session", payload) do
|
15
|
+
blk&.call(payload)
|
16
|
+
end
|
17
|
+
end
|
10
18
|
end
|
11
|
-
end
|
12
19
|
|
13
20
|
ActiveSupport.run_load_hooks(:stored_session_store_instrumentation, self)
|
14
21
|
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module StoredSession
|
2
|
+
class Store < ActionDispatch::Session::AbstractSecureStore
|
3
|
+
module Logging
|
4
|
+
extend ActiveSupport::Concern
|
5
|
+
|
6
|
+
included do
|
7
|
+
delegate :logger, to: :StoredSession
|
8
|
+
end
|
9
|
+
|
10
|
+
def initialize(app, options = {})
|
11
|
+
super
|
12
|
+
@silence = options.fetch(:silence) { true }
|
13
|
+
end
|
14
|
+
|
15
|
+
private
|
16
|
+
def silence(&blk)
|
17
|
+
@silence ? ActiveRecord::Base.logger.silence(&blk) : yield
|
18
|
+
end
|
19
|
+
|
20
|
+
ActiveSupport.run_load_hooks(:stored_session_store_logging, self)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
data/lib/stored_session/store.rb
CHANGED
@@ -1,57 +1,41 @@
|
|
1
1
|
require_relative "store/instrumentation"
|
2
|
+
require_relative "store/logging"
|
2
3
|
|
3
4
|
class StoredSession::Store < ActionDispatch::Session::AbstractSecureStore
|
4
|
-
include
|
5
|
+
include StoredSession::Store::Logging
|
5
6
|
include StoredSession::Store::Instrumentation
|
6
7
|
|
7
|
-
delegate :logger, to: :StoredSession
|
8
|
-
|
9
|
-
attr_reader :silence
|
10
|
-
alias :silence? :silence
|
11
|
-
|
12
8
|
attr_reader :session_class
|
13
9
|
|
14
10
|
def initialize(app, options = {})
|
15
11
|
super
|
16
|
-
|
17
12
|
@session_class = options.fetch(:session_class) { StoredSession.config.session_class }
|
18
|
-
@silence = true unless options.key?(:silence)
|
19
13
|
end
|
20
14
|
|
21
15
|
def find_session(env, sid)
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
[ generate_sid, {} ]
|
28
|
-
end
|
16
|
+
instrument(:read, sid) do |payload|
|
17
|
+
if sid && (data = session_class.read(sid.private_id))
|
18
|
+
[ sid, data || {} ]
|
19
|
+
else
|
20
|
+
[ generate_sid, {} ]
|
29
21
|
end
|
30
22
|
end
|
31
23
|
end
|
32
24
|
|
33
25
|
def write_session(req, sid, session, options)
|
34
|
-
|
35
|
-
|
36
|
-
return false unless session_class.write(sid.private_id, session)
|
26
|
+
instrument(:write, sid) do |payload|
|
27
|
+
return false unless session_class.write(sid.private_id, session)
|
37
28
|
|
38
|
-
|
39
|
-
end
|
29
|
+
sid
|
40
30
|
end
|
41
31
|
end
|
42
32
|
|
43
33
|
def delete_session(req, sid, options)
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
generate_sid
|
48
|
-
end
|
34
|
+
instrument(:delete, sid) do |payload|
|
35
|
+
session_class.by_sid(sid.private_id).delete_all
|
36
|
+
generate_sid
|
49
37
|
end
|
50
38
|
end
|
51
39
|
|
52
|
-
def silence(&)
|
53
|
-
@silence ? logger.silence(&) : yield
|
54
|
-
end
|
55
|
-
|
56
40
|
ActiveSupport.run_load_hooks(:stored_session_store, self)
|
57
41
|
end
|
@@ -1,3 +1,22 @@
|
|
1
|
+
# :markup: markdown
|
2
|
+
|
1
3
|
module StoredSession
|
2
|
-
VERSION
|
4
|
+
module VERSION
|
5
|
+
MAJOR = 0
|
6
|
+
MINOR = 4
|
7
|
+
TINY = 0
|
8
|
+
PRE = nil
|
9
|
+
|
10
|
+
STRING = [ MAJOR, MINOR, TINY, PRE ].compact.join(".")
|
11
|
+
end
|
12
|
+
|
13
|
+
# Returns the currently loaded version of Stored Session as a `Gem::Version`.
|
14
|
+
def self.gem_version
|
15
|
+
Gem::Version.new VERSION::STRING
|
16
|
+
end
|
17
|
+
|
18
|
+
# Returns the currently loaded version of Stored Session as a `String`.
|
19
|
+
def self.version
|
20
|
+
VERSION::STRING
|
21
|
+
end
|
3
22
|
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
namespace :stored_session do
|
2
|
+
desc "Expire inactive sessions"
|
3
|
+
task expire: :environment do
|
4
|
+
StoredSession::Session.expire
|
5
|
+
end
|
6
|
+
|
7
|
+
desc "Queue a job to expire inactive sessions"
|
8
|
+
task "expire_later" => :environment do
|
9
|
+
StoredSession::Session.expire_later
|
10
|
+
end
|
11
|
+
end
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stored_session
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tony Burns
|
@@ -35,7 +35,7 @@ cert_chain:
|
|
35
35
|
Gso2iuR/JK+nlYYHnXZSMQgPTNEv7urC3s3YBLkEeZAyKSzTub/yFiZ0f1rZECNq
|
36
36
|
RdwSWsf01XE0bKBtz4/dixrX45mIFrPmGp1gobRN/q4Tq3lU
|
37
37
|
-----END CERTIFICATE-----
|
38
|
-
date: 2024-11-
|
38
|
+
date: 2024-11-08 00:00:00.000000000 Z
|
39
39
|
dependencies:
|
40
40
|
- !ruby/object:Gem::Dependency
|
41
41
|
name: actionpack
|
@@ -43,56 +43,56 @@ dependencies:
|
|
43
43
|
requirements:
|
44
44
|
- - ">="
|
45
45
|
- !ruby/object:Gem::Version
|
46
|
-
version: 8.0.0
|
46
|
+
version: 8.0.0
|
47
47
|
type: :runtime
|
48
48
|
prerelease: false
|
49
49
|
version_requirements: !ruby/object:Gem::Requirement
|
50
50
|
requirements:
|
51
51
|
- - ">="
|
52
52
|
- !ruby/object:Gem::Version
|
53
|
-
version: 8.0.0
|
53
|
+
version: 8.0.0
|
54
54
|
- !ruby/object:Gem::Dependency
|
55
55
|
name: activejob
|
56
56
|
requirement: !ruby/object:Gem::Requirement
|
57
57
|
requirements:
|
58
58
|
- - ">="
|
59
59
|
- !ruby/object:Gem::Version
|
60
|
-
version: 8.0.0
|
60
|
+
version: 8.0.0
|
61
61
|
type: :runtime
|
62
62
|
prerelease: false
|
63
63
|
version_requirements: !ruby/object:Gem::Requirement
|
64
64
|
requirements:
|
65
65
|
- - ">="
|
66
66
|
- !ruby/object:Gem::Version
|
67
|
-
version: 8.0.0
|
67
|
+
version: 8.0.0
|
68
68
|
- !ruby/object:Gem::Dependency
|
69
69
|
name: activerecord
|
70
70
|
requirement: !ruby/object:Gem::Requirement
|
71
71
|
requirements:
|
72
72
|
- - ">="
|
73
73
|
- !ruby/object:Gem::Version
|
74
|
-
version: 8.0.0
|
74
|
+
version: 8.0.0
|
75
75
|
type: :runtime
|
76
76
|
prerelease: false
|
77
77
|
version_requirements: !ruby/object:Gem::Requirement
|
78
78
|
requirements:
|
79
79
|
- - ">="
|
80
80
|
- !ruby/object:Gem::Version
|
81
|
-
version: 8.0.0
|
81
|
+
version: 8.0.0
|
82
82
|
- !ruby/object:Gem::Dependency
|
83
83
|
name: railties
|
84
84
|
requirement: !ruby/object:Gem::Requirement
|
85
85
|
requirements:
|
86
86
|
- - ">="
|
87
87
|
- !ruby/object:Gem::Version
|
88
|
-
version: 8.0.0
|
88
|
+
version: 8.0.0
|
89
89
|
type: :runtime
|
90
90
|
prerelease: false
|
91
91
|
version_requirements: !ruby/object:Gem::Requirement
|
92
92
|
requirements:
|
93
93
|
- - ">="
|
94
94
|
- !ruby/object:Gem::Version
|
95
|
-
version: 8.0.0
|
95
|
+
version: 8.0.0
|
96
96
|
- !ruby/object:Gem::Dependency
|
97
97
|
name: zeitwerk
|
98
98
|
requirement: !ruby/object:Gem::Requirement
|
@@ -131,7 +131,7 @@ files:
|
|
131
131
|
- CHANGELOG.md
|
132
132
|
- MIT-LICENSE
|
133
133
|
- README.md
|
134
|
-
- app/jobs/stored_session/
|
134
|
+
- app/jobs/stored_session/expire_sessions_job.rb
|
135
135
|
- app/models/stored_session/record.rb
|
136
136
|
- app/models/stored_session/session.rb
|
137
137
|
- config/locales/stored_session.en.yml
|
@@ -142,10 +142,11 @@ files:
|
|
142
142
|
- lib/stored_session/configuration.rb
|
143
143
|
- lib/stored_session/deprecator.rb
|
144
144
|
- lib/stored_session/engine.rb
|
145
|
-
- lib/stored_session/gem_version.rb
|
146
145
|
- lib/stored_session/log_subscriber.rb
|
146
|
+
- lib/stored_session/model.rb
|
147
147
|
- lib/stored_session/store.rb
|
148
148
|
- lib/stored_session/store/instrumentation.rb
|
149
|
+
- lib/stored_session/store/logging.rb
|
149
150
|
- lib/stored_session/test_helper.rb
|
150
151
|
- lib/stored_session/version.rb
|
151
152
|
- lib/tasks/stored_session_tasks.rake
|
@@ -154,10 +155,10 @@ licenses:
|
|
154
155
|
- MIT
|
155
156
|
metadata:
|
156
157
|
bug_tracker_uri: https://github.com/tbhb/stored_session/issues
|
157
|
-
changelog_uri: https://github.com/tbhb/stored_session/blob/v0.
|
158
|
+
changelog_uri: https://github.com/tbhb/stored_session/blob/v0.4.0/CHANGELOG.md
|
158
159
|
documentation_uri: https://github.com/tbhb/stored_session
|
159
160
|
mailing_list_uri: https://github.com/tbhb/stored_session/discussions
|
160
|
-
source_code_uri: https://github.com/tbhb/stored_session/tree/v0.
|
161
|
+
source_code_uri: https://github.com/tbhb/stored_session/tree/v0.4.0
|
161
162
|
rubygems_mfa_required: 'true'
|
162
163
|
post_install_message:
|
163
164
|
rdoc_options: []
|
metadata.gz.sig
CHANGED
Binary file
|
@@ -1,9 +0,0 @@
|
|
1
|
-
class StoredSession::TrimSessionsJob < StoredSession.config.base_job_class
|
2
|
-
queue_as StoredSession.config.trim_sessions_job_queue_as
|
3
|
-
|
4
|
-
def perform(max_created_age: nil, max_updated_age: nil)
|
5
|
-
StoredSession::Session.trim!(max_created_age:, max_updated_age:)
|
6
|
-
end
|
7
|
-
|
8
|
-
ActiveSupport.run_load_hooks(:stored_session_trim_sessions_job, self)
|
9
|
-
end
|
@@ -1,17 +0,0 @@
|
|
1
|
-
# :markup: markdown
|
2
|
-
|
3
|
-
module StoredSession
|
4
|
-
# Returns the currently loaded version of Stored Session as a `Gem::Version`.
|
5
|
-
def self.gem_version
|
6
|
-
Gem::Version.new VERSION::STRING
|
7
|
-
end
|
8
|
-
|
9
|
-
module VERSION
|
10
|
-
MAJOR = 0
|
11
|
-
MINOR = 2
|
12
|
-
TINY = 0
|
13
|
-
PRE = "".freeze
|
14
|
-
|
15
|
-
STRING = [ MAJOR, MINOR, TINY, PRE ].compact.join(".")
|
16
|
-
end
|
17
|
-
end
|