Skip to content
GitLab
Explore
Projects
Groups
Topics
Snippets
Projects
Groups
Topics
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
MKCLOS
Core Development Platform
corepkgv2
Commits
6a15c664
Commit
6a15c664
authored
5 years ago
by
Akshay Bharambe
Browse files
Options
Downloads
Patches
Plain Diff
Add: Docs
parent
3e3f6315
Branches
Branches containing commit
Tags
Tags containing commit
2 merge requests
!173
Mep release19032020
,
!170
Add: Functionality to call session manager from bls.
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
sessionmanagermdl/sessionmanager.go
+5
-1
sessionmanagermdl/sessionmanager.go
with
5 additions
and
1 deletion
sessionmanagermdl/sessionmanager.go
+
5
−
1
View file @
6a15c664
...
...
@@ -19,6 +19,7 @@ type Entry struct {
}
const
(
// keys for the entry object
KEY_DATA
=
"data"
KEY_EXPIREDAT
=
"expiredAt"
KEY_EXPIRATION
=
"expiration"
...
...
@@ -86,6 +87,9 @@ func ToObject(entry Entry) map[string]interface{} {
func
Store
(
key
string
,
entry
Entry
)
{
duration
:=
time
.
Duration
(
entry
.
Expiration
)
*
time
.
Second
// if session manager uses redis cache, the data field (gjson.Result) is saved as is.
// This adds irrelevant fields in redis cache and we get them on retrieve operation.
// The followinf operation needs to be performed so thar the data is marshaled correctly. Redis only accepts []byte{}.
if
store
.
Type
()
==
cachemdl
.
TypeRedisCache
{
store
.
SetWithExpiration
(
key
,
NewRedisEntry
(
entry
),
duration
)
return
...
...
@@ -118,7 +122,7 @@ func Retrieve(key string) (Entry, error) {
}
}
// Delete removes the entry from session manager
// Delete removes the entry from session manager
. If the key is not present, error `ErrSessionNotFound` will be thrown. Caller can ignore error if this is acceptable.
func
Delete
(
key
string
)
error
{
_
,
ok
:=
store
.
Get
(
key
)
if
!
ok
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Topics
Snippets