pathable:meteor-fast-methods

v0.0.1Published 5 years ago

This package has not had recent updates. Please investigate it's current state before committing to using it in your project.

Meteor fast methods

Cached methods and initial data population for free with redis-oplog. WIP, please don't use it yet.

Usage

Preload data

For loading data directly on minimongo for each page serve, use the following on the server:

preloadData(sink => {
  const { community } = getContext(sink, true) || {};
  return [Images.find({ communityId: community._id })];
});

sink is the meteor server-render package object.

Cached Methods

Define new methods with CachedValidatedMethod exported from this package, and set enableCache: true. They will be automatically cached on redis.

1export default new CachedValidatedMethod({
2  name: 'dataImport/importJobs#update',
3  mixins: [updatable(ImportJobs), scopedMethod],
4  validate: updateSchema.validator(),
5  enableCache: true,
6});

Configuration

//TODO: Cache expiration time