Skip to content

v3.0.0

Latest
Compare
Choose a tag to compare
@vividvilla vividvilla released this 01 Jun 09:00

What's Changed

  • Store API Changes

    • The Store no longer generates the session ID; it is now passed on to the Create() method.
    • Introduced a new method, SetMulti(), to set key-value pairs.
    • The Commit() method has been removed. Both Set() and SetMulti() methods now apply changes immediately to the store.
    • The Clear() method now only empties the session.
    • A new method, Destroy(), has been added to delete the session.
  • Session Manager API Changes

    • Cookie-related options have been moved to Options.Cookie.
    • The RegisterSetCookie and RegisterGetCookie methods have been removed and replaced with SetCookieHooks, which takes get and set cookie callbacks respectively.
    • The Options.DisableAutoSet option has been removed and replaced with Options.EnableAutoCreate. A new session will not be created automatically unless Options.EnableAutoCreate is set to true.
    • Added a new method, manager.NewSession(), to create a new session. Since sessions are not created automatically on Acquire() if Options.EnableAutoCreate is not set to true.
    • The Acquire() method now takes context as the first parameter instead of the last.
    • Introduced a new method, SetCookieHooks, which can be used to override session ID generation and validation. By default, a 32-character alphanumeric ID is generated, and the length can be changed using Options.SessionIDLength.
  • Session API Changes

    • Removed the ErrorFieldNotFound error. The store returns a nil value if a field is not found. If chained with type assertion helpers, then ErrNil will be raised when the value is nil.
    • The LoadValues() and ResetValues() methods have been removed and replaced with Cache() and ResetCache() methods. Unlike the previous version, all mutations are saved in the cache if Cache() is called.
    • The Clear() method no longer clears the cookie and only empties the session. Use the new Destroy() method to delete the session and clear the cookie.

Full Changelog: v2.0.1...v3.0.0