Class: Aws::SessionStore::DynamoDB::Locking::Base Private

Inherits:
Object
  • Object
show all
Defined in:
lib/aws/session_store/dynamo_db/locking/base.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Handles session management.

Direct Known Subclasses

Null, Pessimistic

Instance Method Summary collapse

Constructor Details

#initialize(cfg) ⇒ Base

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Base.



9
10
11
# File 'lib/aws/session_store/dynamo_db/locking/base.rb', line 9

def initialize(cfg)
  @config = cfg
end

Instance Method Details

#delete_session(env, sid) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Deletes session based on id



31
32
33
34
35
# File 'lib/aws/session_store/dynamo_db/locking/base.rb', line 31

def delete_session(env, sid)
  handle_error(env) do
    @config.dynamo_db_client.delete_item(delete_opts(sid))
  end
end

#get_session_data(env, sid) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Retrieves session data based on id

Raises:

  • (NotImplementedError)


26
27
28
# File 'lib/aws/session_store/dynamo_db/locking/base.rb', line 26

def get_session_data(env, sid)
  raise NotImplementedError
end

#set_session_data(env, sid, session, options = {}) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Updates session in database



14
15
16
17
18
19
20
21
22
23
# File 'lib/aws/session_store/dynamo_db/locking/base.rb', line 14

def set_session_data(env, sid, session, options = {})
  return false if session.empty?

  packed_session = pack_data(session)
  handle_error(env) do
    save_opts = update_opts(env, sid, packed_session, options)
    @config.dynamo_db_client.update_item(save_opts)
    sid
  end
end