Is caching logic available from a Script API?

Former Member
Former Member

I'd like to be able to get/set a cached value for a user, preferably with a configurable TTL.  Is there a way to do this from a Widget - either with Velocity or JavaScript?

(pseudo-code e.g.)

var accessToken = someApi.userCache.get("remote.service.access.token", null);

if (accessToken == null) {
 accessToken = generateAccessToken(currentUser);
 someApi.userCache.set("remote.service.access.token", accessToken, timespan(30, "minutes"));
}

Parents Reply
  • Former Member
    0 Former Member in reply to Michael Monteleone

    Hi  - no, it's for a code-only widget that needs to compute an access token to access an existing external integration and it needs to be accessible on all pages.  The existing implementation had access to a user-level cache, but I can just bypass that for the time being and address it if it ends up being a performance issue. 

    Thanks for the link on the "Widget Extensions".  That will actually be pretty helpful.

    Thanks!

Children