Skip to content

Commit

Permalink
createKey() override (#41)
Browse files Browse the repository at this point in the history
Look for a createKey function on the Model prototype and use it if found.  Otherwise, use the createKey function found in koop-core.
  • Loading branch information
rgwozdz authored Jul 20, 2018
1 parent 99d01c4 commit 35afa01
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).

## Unreleased
### Added
* Prefentially use a `createKey` function found on the Model's prototype

## Fixed
* Apply standard.js to source and test files
* Make style adjustments to pass standard.js
Expand Down
2 changes: 1 addition & 1 deletion src/models/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ function Model (options) {
}

Model.prototype.pull = function (req, callback) {
const key = createKey(req)
const key = (this.createKey) ? this.createKey(req) : createKey(req)
this.cache.retrieve(key, req.query, (err, cached) => {
if (!err && isFresh(cached)) {
callback(null, cached)
Expand Down

0 comments on commit 35afa01

Please sign in to comment.