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.



7
8
9
# File 'lib/aws/session_store/dynamo_db/locking/base.rb', line 7

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



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

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)


24
25
26
# File 'lib/aws/session_store/dynamo_db/locking/base.rb', line 24

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



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

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