koopjs / koop-pgcache

PostGIS cache for Koop.
Other
4 stars 4 forks source link

Problem to register the koop-pgcache in koop #59

Closed JoanPere closed 4 years ago

JoanPere commented 4 years ago

I am using the koop-pgcache@1.7.2 I am having errors to register the koop-pgcache in koop. Following the instructions of the Readme page i try to use the method koop.registerCache(), but koop don't have this method. I have seen that the method is koop.register(), and then the type of plugin go to the method _registerCache. In this method, there are a constructor of the plugin, but koop-pgcache dont have any constructor and then service crash. The error is:

C:\koopTest\variosProviders\app\node_modules\koop\dist\index.js:269
this.cache = new Cache()
             ^

TypeError: Cache is not a constructor

I find in the koop git, that there was a change in a commit about the way to create the cache object: image before of this the connection to the pg db was performed in the koop/dist/index.js file. With the following changes, it is assumed that the cache plugin has a constructor and the connection will be performed in the constructor.

Thanks!

rgwozdz commented 4 years ago

@JoanPere koop-pgcache has never been updated to use Koop 3.x. The last release that still supported koop-pgcache was 3.0.0-alpha.29. Commits thereafter (Feb 2017) included breaking changes (cache registration, etc) that lead to the release of Koop 3.x. If you really need to use pgcache you can install 3.0.0-alpha.29, though its very out of date. Can you use the Redis cache instead?

JoanPere commented 4 years ago

@rgwozdz thanks for your fast reply. I would like to konw if there are a "strong" reason to not continue updating the koop-pgcache to the newest koop versions. In my company we have a project that we are going to use koop and using a cache with geospatial capabilities is clue to have the best performance solution. Thanks in advance!

rgwozdz commented 4 years ago

Glad to help. I don't think there is any reason not to update the koop-pgcache, though I think it will take some work. I think there hasn't been an effort to maintain it because for most applications, (1) the in-memory cache is sufficient and comes with Koop, and (2) the Redis cache is easier to implement and maintain.

JoanPere commented 4 years ago

Really good news! I have done some modifications to the koop-pgcache, and i can connect to the Koop 3.x. Now i am going to perform some cache tasks. Then i will evaluate if we can use it or if we choose redis. Thanks!