<commit_before>package arn

import (
	"fmt"

	"github.com/aerogo/aero"
	as "github.com/aerospike/aerospike-client-go"
)

// SessionStoreAerospike is a store saving sessions in an Aerospike database.
type SessionStoreAerospike struct {
	set string
}

// NewAerospikeStore creates a session store using an Aerospike database.
func NewAerospikeStore(set string) *SessionStoreAerospike {
	return &SessionStoreAerospike{
		set: set,
	}
}

// Get loads the initial session values from the database.
func (store *SessionStoreAerospike) Get(sid string) *aero.Session {
	key, _ := as.NewKey(DB.Namespace(), store.set, sid)
	record, err := DB.Client.Get(nil, key)

	if err != nil || record == nil {
		fmt.Println(err)
		return nil
	}

	return aero.NewSession(sid, record.Bins)
}

// Set updates the session values in the database.
func (store *SessionStoreAerospike) Set(sid string, session *aero.Session) {
	sessionData := session.Data()
	key, _ := as.NewKey(DB.Namespace(), store.set, sid)

	if sessionData == nil {
		DB.Client.Delete(nil, key)
	} else {
		DB.Client.Put(nil, key, sessionData)
	}
}<commit_msg>Updated session store<commit_after>package arn

import (
	"fmt"

	"github.com/aerogo/session"
	as "github.com/aerospike/aerospike-client-go"
)

// SessionStoreAerospike is a store saving sessions in an Aerospike database.
type SessionStoreAerospike struct {
	set string
}

// NewAerospikeStore creates a session store using an Aerospike database.
func NewAerospikeStore(set string) *SessionStoreAerospike {
	return &SessionStoreAerospike{
		set: set,
	}
}

// Get loads the initial session values from the database.
func (store *SessionStoreAerospike) Get(sid string) *session.Session {
	key, _ := as.NewKey(DB.Namespace(), store.set, sid)
	record, err := DB.Client.Get(nil, key)

	if err != nil || record == nil {
		fmt.Println(err)
		return nil
	}

	return session.New(sid, record.Bins)
}

// Set updates the session values in the database.
func (store *SessionStoreAerospike) Set(sid string, session *session.Session) {
	sessionData := session.Data()
	key, _ := as.NewKey(DB.Namespace(), store.set, sid)

	if sessionData == nil {
		DB.Client.Delete(nil, key)
	} else {
		DB.Client.Put(nil, key, sessionData)
	}
}
{'fraction_non_alphanumeric': 0.11907983761840325, 'fraction_numerical': 0.0, 'mean_word_length': 4.344578313253012, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2670022', 'n_tokens_mistral': 794, 'n_tokens_neox': 750, 'n_words': 208}