title: Prevent repeated queries in Apollo Server 2
body: <p>For security reasons, I am looking for a way to block bad actors from sending repeated queries on the server over and over again, as it may result in a poor execution performance and/or high deployment price.</p>
  
  <p>In the <a href="https://www.apollographql.com/docs/apollo-server/v2/features/data-sources.html#Using-Memcached-Redis-as-a-cache-storage-backend" rel="nofollow noreferrer">Apollo Server Documentation</a>, there is a link to how to implement our own cache backend using <code>KeyValueCache</code>, but I am just not sure about how to use it to prevent repeated queries from running multiple times.</p>
  
  <p>Maybe I am not viewing the whole matter from the right angle, so please if you have any suggestions it would be of a great help.</p>
  
  <p>Thanks</p>