How to add attributes to a Cache?.

I'm new to apigee, pls enlighten me about how caching in apigee works or how I could do the ff. in apigee.

I want to create a cache that has this unique identifier named SessionID and associate with it are some other parameters. I was able to do this by using attributes to add additional information to the token on token creation. So whenever I add an attribute companyName on my GenerateToken policy, I could call it on another proxy with just accessToken.companyName to display/use its value. But without having an accessToken yet. How do I do that with a PopulateCache Policy?. Is it possible to do there?. .
I basically want to store multiple attributes to cache and reference the attributes via the session ID and call it much like I could do with accessToken.

If this cannot be done. Is it really just okay to create multiple CacheKeys and call the values related to it on LookUp Cache?, will there be performance issues or is this how its really done?. I was just thinking that this is like creating multiple tables and relating this tables to one another as they are basically for the same session ID anyway and could possibly slow down the process all the while this could be in a single column of the table if this is a table...

So if I'm gonna implement Unique multipleCacheKeys and storing each attribute to it. I will then have the following Unique CacheKey names to call the correct attributes I need then?. (BTW, the names after the CodeChallenge name is the attributes I need to store in my session of where I want it be stored in a single SessionID if only allowed.)

CodeChallenge+Challenge
CodeChallenge+ClientID
CodeChallenge+redirectUri
CodeChallenge+scope
CodeChallenge+challengeMethod

By the way, what is Apigee Cache browser wise. It it the one responsible for creating cookies in the browser?.

Solved Solved
0 4 293
1 ACCEPTED SOLUTION

Hi @Joshua Carino,

Here is my understanding on your question,

1 -Having a cache key is not a good idea in this case, you should go with access token and based on access token you can get the data from custom attributes.

2- Instead using apigee to store the data of custom attributes, utilize the session of your application and store all data in session key and based on session id you can send the required data in headers of the api

3. Use proxy chaining so you can get the forward the flow variable to the child proxy.

4. generate UUID for the user and treat it as a temp cache key if nothing works you in your case

5- [BEST OPTION] Access token implementation is not a big deal with apigee so go for that instead spending time here and there.

Provide more information would be good for you to seek more help here.

View solution in original post

4 REPLIES 4

You shouldn't be storing session data in cache, immediate subsequent requests wont find cache results and cache is subject to disappearing.

Yes, that's exactly the same reason why I want to cache attributes by associating it with a session ID.Since this data will only be valid for give or take 5-10 minutes and won't be needed after the login process.We're not using accessTokens for now in this process of where I could possibly store the attributes in the tokens, so I'm curious as to how I would do the same thing in a cache.

Hi @Joshua Carino,

Here is my understanding on your question,

1 -Having a cache key is not a good idea in this case, you should go with access token and based on access token you can get the data from custom attributes.

2- Instead using apigee to store the data of custom attributes, utilize the session of your application and store all data in session key and based on session id you can send the required data in headers of the api

3. Use proxy chaining so you can get the forward the flow variable to the child proxy.

4. generate UUID for the user and treat it as a temp cache key if nothing works you in your case

5- [BEST OPTION] Access token implementation is not a big deal with apigee so go for that instead spending time here and there.

Provide more information would be good for you to seek more help here.

BTW. thanks, I did the fifth recommendation then and used an access Token (created with the implicit grant) when caching the parameters / attributes we need for the implementation of OAuth-PKCE.