created Options interface #33
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Options
interface exposes the privateoptions
struct without breaking code, so this is backwards-compatible. Onlygetters
are available on the interface.set
functions could be added later, if desired. The interface is available through themanager.Opts()
function. Added a single test function that compares against defaults.Opts()
allows web frameworks (eg echo) to create middleware that will play nicely with scs. See issues The problem of log.Println() in Use() function #24 and problems with using wrapping Use for echo.There are two additional commits associated with this pull request. This was actually unintended b/c I began the pull request before the 2nd two commits were added but Github automatically added them to this request. I can try splitting out, if you want.
All three commits are backwards-compatible with the defaults.
Re.
saved
property to session: helps the backend data store determine stale records. Also required byTouchWithInterval()
to know ifTouch()
should occur. In order to preserve strict backwards compatibility, I added amanager.UseSaved()
function. If theopts.useSaved
value is true, only then will the date be saved in the sessions store.Re.
TouchWithInterval
: limits amount of unnecessary writes to back end data store. This would close #32.I have an an echo middleware example but will wait to commit and have that conversation after we can get past these. Thanks!