Commit graph

2551 commits

Author SHA1 Message Date
Jesse Rosenberger
33d1f82814
Publish
- apollo-cache-control@0.5.0-alpha.1
 - apollo-datasource-rest@0.3.0-alpha.1
 - apollo-datasource@0.3.0-alpha.1
 - apollo-engine-reporting@0.3.0-alpha.1
 - apollo-server-azure-functions@2.4.0-alpha.1
 - apollo-server-cache-memcached@0.3.0-alpha.1
 - apollo-server-cache-redis@0.3.0-alpha.1
 - apollo-server-caching@0.3.0-alpha.1
 - apollo-server-cloud-functions@2.4.0-alpha.1
 - apollo-server-cloudflare@2.4.0-alpha.1
 - apollo-server-core@2.4.0-alpha.1
 - apollo-server-express@2.4.0-alpha.1
 - apollo-server-hapi@2.4.0-alpha.1
 - apollo-server-integration-testsuite@2.4.0-alpha.1
 - apollo-server-koa@2.4.0-alpha.1
 - apollo-server-lambda@2.4.0-alpha.1
 - apollo-server-micro@2.4.0-alpha.1
 - apollo-server-plugin-base@0.3.0-alpha.1
 - apollo-server-testing@2.4.0-alpha.1
 - apollo-server@2.4.0-alpha.1
 - apollo-tracing@0.5.0-alpha.1
 - graphql-extensions@0.5.0-alpha.1
2019-01-16 13:11:21 +02:00
Jesse Rosenberger
7a0d0e6e96
[debug] Print out documentStore stats every 60 seconds.
In an effort to see how effective this cache is in production during this
alpha phase, we'll print out the stats on the document store every 60
seconds.
2019-01-16 13:07:17 +02:00
Jesse Rosenberger
be7162094c
Shift the burden of object approximation into the ApolloServerBase class.
The implementation of object-size approximation which is used for cache
eviction purposes in the `InMemoryLRUCache` implementation (via `lru-cache`)
was a short-term location for extensible logic which is better located
within `ApolloServerBase`.

This is particularly important since future logic may necessitate knowing or
understanding the current size (roughly, memory usage) of the in-memory
storage.  Effective immediately, this adds support for providing a `dispose`
function which is called when an object is purged from the cache to make
room for another.
2019-01-16 12:46:48 +02:00
Jesse Rosenberger
0879a1267e
Be considerate of variable length utf-8 encodings in InMemoryLRUCache.
Previously, this used the `JSON.stringify` length, but this is slightly more
aware.
2019-01-15 17:45:20 +02:00
Jesse Rosenberger
1a9d65dd81
Guard against (currently impossible) failure to read from documentStore.
While the implementation of the `documentStore` is currently simple enough
to never throw (it is in-memory), it makes some sense to guard against future
extended functionality where an exception might be raised.

Since storing this object in a distributed memory store isn't currently
feasible, I'm not sure what such an exception would be right now, but I
don't mind being proactive!

Ref: https://github.com/apollographql/apollo-server/pull/2111/files#r247618501
2019-01-15 17:03:00 +02:00
Jesse Rosenberger
f546086e95
Fix typos/spacing in commentary.
Of my own making!
2019-01-15 17:03:00 +02:00
Jesse Rosenberger
2652057c33
Clarify comments surrounding documentStore, which led to confusion.
The parsed/validated cache store is on by default.  While it could be disabled,
in theory, it cannot be disabled since its an internal property of the
request pipeline processor class.

See confusion here:

  https://github.com/withspectrum/spectrum/pull/4533#issuecomment-453446535
2019-01-15 17:02:59 +02:00
Jesse Rosenberger
f33ae19f6d
Ensure requestContext.document set, irregardless of documentStore use.
Without this change, the `document` property was not set on the
`requestContext` for consumption by request pipeline plugins.

To further guard against this oversight, I've removed the extra `document`
variable which was being used as scoped state for the document and switched to
directly using (and assigning to) the `requestContext.document`.

Nice catch, @glasser!

Ref: https://github.com/apollographql/apollo-server/pull/2111/files#r247617469
2019-01-15 17:02:59 +02:00
Jesse Rosenberger
45f14a2971
Fix incorrect contraction in code comment, per feedback.
Ref: https://github.com/apollographql/apollo-server/pull/2111/files#r247616489
2019-01-15 17:02:58 +02:00
Jesse Rosenberger
ea7da3a38c
Merge branch 'master' into abernix/cache-parsed-validated 2019-01-14 20:39:36 +02:00
renovate[bot]
9fbf1ea677
chore(deps): update dependency yup to v0.26.7 (#2175) 2019-01-11 09:30:32 +00:00
renovate[bot]
2498dc7b1e
chore(deps): update dependency tslint to v5.12.1 (#2174) 2019-01-11 07:33:06 +00:00
renovate[bot]
ae2fa69736
chore(deps): update dependency lerna to v3.10.5 (#2173) 2019-01-11 04:33:09 +00:00
renovate[bot]
265b403196
chore(deps): update dependency lerna to v3.10.2 (#2169) 2019-01-10 04:19:39 +00:00
renovate[bot]
cc3ad8c854
chore(deps): update dependency lerna to v3.10.1 (#2166) 2019-01-09 04:17:26 +00:00
Jesse Rosenberger
9b8dc1b607
Address unaddressed feedback from #1223.
These were things I'd suggested prior to merging and I just happened to come across it again, only to find they were still outstanding:

https://github.com/apollographql/apollo-server/pull/1223
2019-01-08 20:25:18 +02:00
renovate[bot]
283013c253
chore(deps): update dependency lerna to v3.9.0 (#2163) 2019-01-08 04:24:14 +00:00
renovate[bot]
68aafbb796
chore(deps): update dependency @types/jest to v23.3.12 (#2161) 2019-01-07 10:24:38 +00:00
renovate[bot]
d069809b88
chore(deps): update dependency lerna to v3.8.5 (#2158) 2019-01-05 05:12:35 +00:00
renovate[bot]
063da8b344
chore(deps): update dependency @types/koa-router to v7.0.37 (#2157) 2019-01-05 04:30:38 +00:00
renovate[bot]
acb5984353
chore(deps): update dependency lerna to v3.8.4 (#2153) 2019-01-03 05:31:56 +00:00
renovate[bot]
6cfbd44e18
chore(deps): update dependency @types/koa-router to v7.0.36 (#2152) 2019-01-03 04:27:36 +00:00
renovate[bot]
225139129e
chore(deps): update dependency redis-mock to v0.42.0 (#2150) 2019-01-02 04:26:19 +00:00
renovate[bot]
0d28fbfd9a
chore(deps): update dependency lerna to v3.8.1 (#2148) 2019-01-01 06:19:02 +00:00
renovate[bot]
0c7d66ef39
chore(deps): update dependency @types/jest to v23.3.11 (#2147) 2019-01-01 05:16:51 +00:00
renovate[bot]
7b438b6e99
chore(deps): update dependency @types/graphql to v14.0.4 (#2146) 2019-01-01 04:27:40 +00:00
renovate[bot]
ab696e8b9b
chore(deps): update dependency husky to v1.3.1 (#2142) 2018-12-28 07:19:55 +00:00
renovate[bot]
394cb9d090
chore(deps): update dependency @types/redis to v2.8.10 (#2126) 2018-12-22 03:33:41 +00:00
renovate[bot]
ac9cb2c8a5
chore(deps): update dependency lerna to v3.8.0 (#2123) 2018-12-21 06:19:01 +00:00
renovate[bot]
ad8539c24e
chore(deps): update dependency @types/redis to v2.8.9 (#2122) 2018-12-21 04:20:56 +00:00
renovate[bot]
dd280daceb
chore(deps): update dependency @types/aws-lambda to v8.10.17 (#2121) 2018-12-21 03:21:58 +00:00
renovate[bot]
64bf1ce2cf
chore(deps): update dependency lerna to v3.7.1 (#2119) 2018-12-20 05:20:27 +00:00
renovate[bot]
0cde716a11
chore(deps): update dependency @types/node to v10.12.18 (#2118) 2018-12-20 04:19:15 +00:00
wtgtybhertgeghgtwtg
ccba8c87da Switch json-stable-stringify to fast-json-stable-stringify. (#2065)
* refactor: switch `json-stable-stringify` to `fast-json-stable-stringify`

* chore: drop `@types/json-stable-stringify`

* Update CHANGELOG.md for #2065.
2018-12-19 20:06:17 +02:00
renovate[bot]
bb2fc6d862
chore(deps): update dependency husky to v1.3.0 (#2116) 2018-12-19 05:25:38 +00:00
renovate[bot]
4add1c3a74
chore(deps): update dependency @types/node to v10.12.17 (#2115) 2018-12-19 04:24:45 +00:00
renovate[bot]
6dfd6a3b70
chore(deps): update dependency @types/hapi to v17.8.2 (#2114) 2018-12-19 03:24:50 +00:00
renovate[bot]
eeb54a41c6
chore(deps): update dependency @types/aws-lambda to v8.10.16 (#2113) 2018-12-19 02:46:07 +00:00
renovate[bot]
a8980494bf
chore(deps): update dependency tslint to v5.12.0 (#2112) 2018-12-19 02:41:09 +00:00
Jesse Rosenberger
7697623789
Publish
- apollo-cache-control@0.5.0-alpha.0
 - apollo-datasource-rest@0.3.0-alpha.0
 - apollo-datasource@0.3.0-alpha.0
 - apollo-engine-reporting@0.3.0-alpha.0
 - apollo-server-azure-functions@2.4.0-alpha.0
 - apollo-server-cache-memcached@0.3.0-alpha.0
 - apollo-server-cache-redis@0.3.0-alpha.0
 - apollo-server-caching@0.3.0-alpha.0
 - apollo-server-cloud-functions@2.4.0-alpha.0
 - apollo-server-cloudflare@2.4.0-alpha.0
 - apollo-server-core@2.4.0-alpha.0
 - apollo-server-express@2.4.0-alpha.0
 - apollo-server-hapi@2.4.0-alpha.0
 - apollo-server-integration-testsuite@2.4.0-alpha.0
 - apollo-server-koa@2.4.0-alpha.0
 - apollo-server-lambda@2.4.0-alpha.0
 - apollo-server-micro@2.4.0-alpha.0
 - apollo-server-plugin-base@0.3.0-alpha.0
 - apollo-server-testing@2.4.0-alpha.0
 - apollo-server@2.4.0-alpha.0
 - apollo-tracing@0.5.0-alpha.0
 - graphql-extensions@0.5.0-alpha.0
2018-12-18 17:14:02 +02:00
Jesse Rosenberger
88a294b178
Add CHANGELOG.md for #2111 (parse/validate document store/cache). 2018-12-18 17:12:23 +02:00
Jesse Rosenberger
b30e9332fc
Cache successfully parsed and validated documents for future requests.
WIP
2018-12-18 11:18:55 +02:00
Jesse Rosenberger
8a1f99916d
Merge pull request #2109 from apollographql/abernix/caching-tweak-prep-two
Improve InMemoryLRUCache implementation.
2018-12-18 11:15:00 +02:00
Jesse Rosenberger
fa63116cd7
Merge branch 'master' into abernix/caching-tweak-prep-two 2018-12-18 11:13:26 +02:00
Jesse Rosenberger
2b50e149b0
caching: InMemoryLRUCache support for ttl, much like Redis/Memcached.
This also re-enables the Expiration tests for this library, though I think I
will continue to leave the testsuite decomposed into more granular methods
for readability and future growth.

Note that this doesn't implement the same default `300` second TTL as the
other Memcache and Redis implementations currently do (a very debatable
default we should re-consider in the future).
2018-12-18 10:55:38 +02:00
Jesse Rosenberger
098c893990
nit: Use the term value rather than data for Key + *Value* stores.
Super nitty, but they are KeyValue stores, not KeyData stores.
2018-12-18 10:55:37 +02:00
Jesse Rosenberger
c7f6b43234
tests: Change apollo-server-caching test-suite to support InMemoryLRUCache. 2018-12-18 10:55:36 +02:00
Jesse Rosenberger
d53f361c54
cache: Implement flush method for InMemoryLRUCache.
This implements the `flush` method, which is currently supported by both
Memcached and Redis, into the `InMemoryLRUCCache` cache.
2018-12-18 10:55:36 +02:00
Jesse Rosenberger
f3981b76a4
Adjust InMemoryLRUCache to allow non-string values via generics.
While it is certainly our current implementation, I'm not sure that the true
spirit of an in-memory key-value store is to only map strings to other strings.

While enforcing `<string, string>` might be necessary for some distributed
cache stores, it seems we shouldn't enforce it for `InMemoryLRUCache`.

By changing the `KeyValueCache` to default to `string` but allow other
options, we can allow the user to decide exactly how the RHS of this store
should be typed.

This does require a bit more flexible implementation of the `length`
calculator which is used for cache ejection, but that implementation will
become immediately useful when we start storing parsed ASTs in this KV store.
2018-12-18 10:55:35 +02:00
Jesse Rosenberger
8ad2bdda75
Merge pull request #2108 from apollographql/abernix/caching-tweak-prep
chores: Request pipeline readability/DRYing.
2018-12-18 10:54:43 +02:00