-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for caching in Flows #16
Comments
Are you considering adding Flow Apex Action(s) to |
@jefersonchaves yeah, the idea is to add Apex invocable actions that can by used in Flow to Since you can have only 1 invocable method per class, and invocable methods don't support generic I haven't spent much time exploring this, but my original thought was to have something like this for each primitive data type: public class FlowStringCacheAdder {
public class FlowInput {
@InvocableVariable(required=true)
public String cacheKey;
@InvocableVariable(required=true)
public String cacheType;
@InvocableVariable(required=true)
public String cacheValue;
}
public static void execute(List<FlowInput> cacheKeys) {
for (FlowInput input : inputs) {
CacheManager.getOrganizationCache().put(input.cacheKey, input.cacheValue);
}
}
} And for retrieving the values... public class FlowStringCacheGetter {
public class FlowInput {
@InvocableVariable(required=true)
public String cacheKey;
@InvocableVariable(required=true)
public String cacheType;
}
public static List<String> execute(List<FlowInput> inputs) {
List<String> cachedValues = new List<String>();
for (FlowInput input : inputs) {
CacheManager.getOrganizationCache().get(input.cacheKey);
}
return cachedValues;
}
} Let me know if you think this pattern/approach makes sense. |
That is interesting because it may be four classes per Data Type (due to the Flow Apex Action structure):
This makes me wonder if this is the right path or if we should do it differently: primarily due to Custom Data Types - which can be handy but maybe not so much in Flows. I'm not fond of using JSON serialization to bypass it due to excessive CPU consumption. Perhaps a top-level class for Get and another for Put with optional variables may work better also because I'm thinking about finding the correct Action on the toolbar. This way it may end up with two with multiple optional inputs and returns:
Another option would be to wrap some of it for Flows, but that is what I'm trying to stay away. |
@jefersonchaves I agree that having 4 classes per data type is a lot of classes, but it feels like the more intuitive & scalable approach overall. My concerns with the approach of a top-level class for
I think there are definitely pros & cons with both options - I'm hoping to build some proof-of-concepts in the coming weeks to see how they compare. |
No description provided.
The text was updated successfully, but these errors were encountered: