Actionhero includes a powerful cache system based on Redis. It can be used to store and retrieve data, but also to create more complex data structures based on queues and expiring object.
The cache methods are documented in detail with annotations here. There are methods fall into 3 categories:
An Action:
import { cache, Action } from "actionhero";
export class CacheTest extends Action {
constructor() {
super();
this.name = "cacheTest";
this.description = "I will test the internal cache functions of the API";
this.inputs = {
key: {
required: true,
formatter: this.stringFormatter,
validator: this.stringValidator,
},
value: {
required: true,
formatter: this.stringFormatter,
validator: this.stringValidator,
},
};
this.outputExample = {
cacheTestResults: {
saveResp: true,
sizeResp: 1,
loadResp: {
key: "cacheTest_key",
value: "value",
createdAt: 1420953269716,
},
deleteResp: true,
},
};
}
stringFormatter(s) {
return String(s);
}
stringValidator(s) {
if (s.length < 3) {
return "inputs should be at least 3 letters long";
} else {
return true;
}
}
async run({ params }) {
const key = `cacheTest_${params.key}`;
const value = params.value;
return {
cacheTestResults = {
saveResp: await cache.save(key, value, 5000),
sizeResp: await cache.size(),
loadResp: await cache.load(key),
deleteResp: await cache.destroy(key),
},
};
}
}
The Actionhero server is open source, under the Apache-2 license
Actionhero runs on Linux, OS X, and Windows
You always have access to the Actionhero team via Slack and Github
We provide support for corporate & nonprofit customers starting at a flat rate of $200/hr. Our services include:
We have packages appropriate for all company sizes. Contact us to learn more.
We provide support for corporate & nonprofit customers starting at a flat rate of $200/hr. Our services include:
We have packages appropriate for all company sizes. Contact us to learn more.
For larger customers in need of a support contract, we offer an enterprise plan including everything in the Premium plan plus: