Skip to content

Instantly share code, notes, and snippets.

@santanuhaldersfdc
Created January 6, 2021 06:35
@RemoteAction
global static ResponseWrapper savePackageInCache(String jsonString, String uniqueKey)
{
ResponseWrapper wrap = new ResponseWrapper();
try
{
String base64Str = EncodingUtil.base64Encode(Blob.valueOf(jsonString));
Datetime currentTime = System.now();
String timeStr = ''+currentTime.Year()+currentTime.Month()+currentTime.Day()
+currentTime.Hour()+currentTime.Minute()+currentTime.Second();
if(String.isBlank(uniqueKey))
{
uniqueKey = UserInfo.getUserId()+timeStr;
}
System.debug('base64Str'+base64Str);
Cache.Org.put('local.PackageXMLStorage.'+uniqueKey, base64Str);
wrap.uniqueKey = uniqueKey;
wrap.isSuccess = true;
}
catch (Exception e) {
wrap.isSuccess = false;
wrap.errorMsg = e.getMessage();
}
return wrap;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment