File tree Expand file tree Collapse file tree 1 file changed +23
-4
lines changed Expand file tree Collapse file tree 1 file changed +23
-4
lines changed Original file line number Diff line number Diff line change @@ -108,15 +108,34 @@ class Executor {
108
108
}
109
109
110
110
/**
111
- * @param {String } ruleLogId The id of the rule log item to get
112
- * @param {String } userId The user id
111
+ * @param {String } ruleLogId The id of the rule log item to get
112
+ * @param {String } userId The user id
113
+ * @param {Objet } [opts={}] Additional options
114
+ * @param {Boolean } [opts.useCache=false] If cached result should be retrieved
115
+ * @param {Boolean } [opts.cacheOnNotFound=false] Whether to cache if a 404 error is returned
116
+ *
113
117
* @returns {Promise }
114
118
*/
115
- getRuleLog ( ruleLogId , userId ) {
119
+ getRuleLog ( ruleLogId , userId , opts ) {
120
+ opts = { useCache : false , cacheOnNotFound : false , ...opts } ;
121
+
116
122
const url = `${ this . url } /rule-logs/${ ruleLogId } ` ;
117
123
const query = { user_id : userId } ;
118
124
119
- return this . auth . send ( this . service , 'GET' , url , { query } ) ;
125
+ return this . auth . send ( this . service , 'GET' , url , {
126
+ query,
127
+ cache : opts . useCache
128
+ ? {
129
+ key : this . auth . genCacheKey (
130
+ this . service ,
131
+ this . getRuleLog . name ,
132
+ ...arguments
133
+ ) ,
134
+ action : this . auth . cache . actions . get ,
135
+ onNotFound : opts . cacheOnNotFound
136
+ }
137
+ : false
138
+ } ) ;
120
139
}
121
140
122
141
/**
You can’t perform that action at this time.
0 commit comments