Skip to content

Commit

Permalink
changing the key structure
Browse files Browse the repository at this point in the history
  • Loading branch information
dmfenton committed Jul 1, 2015
1 parent 33fea48 commit fa4a491
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).

## [1.1.4] - 2016-07-1
### Changed
* Using a different key struction for db and exports

## [1.1.3] - 2016-07-01
### Changed
* Bumping the version because previous publish was wrong
Expand Down
2 changes: 1 addition & 1 deletion controller/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ var Controller = function (OpenData, BaseController) {
var stringedParams = JSON.stringify(req.params)
var toHash = stringedParams + JSON.stringify(req.query)
var key = crypto.createHash('md5').update(toHash).digest('hex')
var dir = 'OpenData' + '/' + req.params.id + crypto.createHash('md5').update(stringedParams).digest('hex')
var dir = 'OpenData' + '/' + req.params.id + '/' + crypto.createHash('md5').update(stringedParams).digest('hex')
var filePath = ['files', dir, key].join('/')
var fileName = key + '.' + req.params.format
OpenData.files.exists(filePath, fileName, function (exists, path) {
Expand Down
4 changes: 2 additions & 2 deletions models/OpenData.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ var OpenData = function (koop) {
openData.getResource = function (host, hostId, params, options, callback) {
params.layer = 0
// delete the mehod param or else we get inconsistent hash keys depending on the request
var key = hostId + ':' + hash.MD5(_.omit(params, 'method'))
var key = hostId + '_' + hash.MD5(_.omit(params, 'method'))
// check the cache for data with this type & id
koop.Cache.get(type, key, options || {layer: 0}, function (err, entry) {
if (err) {
Expand Down Expand Up @@ -309,7 +309,7 @@ var OpenData = function (koop) {
delete params.method
params.layer = 0
var stringedParams = JSON.stringify(params)
var dir = 'OpenData' + '/' + params.id + crypto.createHash('md5').update(stringedParams).digest('hex')
var dir = 'OpenData' + '/' + params.id + '/' + crypto.createHash('md5').update(stringedParams).digest('hex')
var key = hostId + ':' + hash.MD5(_.omit(params, 'method'))
koop.Cache.remove(type, key, {}, function (err, res) {
if (err) return callback(err)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "koop-opendata",
"description": "An ArcGIS Open Data Provider for Koop",
"version": "1.1.3",
"version": "1.1.4",
"author": "Daniel Fenton",
"contributors": ["Courtney Claessens"],
"bugs": {
Expand Down

0 comments on commit fa4a491

Please sign in to comment.