Skip to content

Commit

Permalink
flatfile: Add option to pass ttl to node-persist
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonharrison committed Feb 26, 2019
1 parent 5b154ff commit c1bfcc3
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/server/db/flatfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,22 @@ export class FlatFile {
/**
* Creates a new FlatFile storage.
*/
constructor({ dir, logging }) {
constructor({ dir, logging, ttl }) {
this.games = require('node-persist');
this.dir = dir;
this.logging = logging || false;
this.ttl = ttl || false;
}

/**
* Connect.
*/
async connect() {
await this.games.init({ dir: this.dir, logging: this.logging });
await this.games.init({
dir: this.dir,
logging: this.logging,
ttl: this.ttl,
});
return;
}

Expand Down

0 comments on commit c1bfcc3

Please sign in to comment.