<commit_before>const Redis = require('ioredis');
const redis = new Redis({
  port: 6379,          // Redis port
  host: '127.0.0.1',   // Redis host
  db: 0
});
redis.config('set', 'maxmemory-policy', 'allkeys-lru');

const setRedisIso = (url, data) => {
  let value = JSON.stringify(data);
  redis.set(url, value)
  .catch(error=>error);
};

const getRedisIso = (url) => {
  return redis.get(url)
  .then(result => {
    console.log('result', result);
    if (result === null) {
      console.log('this place is not in the db, fall to navitia');
      return result;
    } else {
      console.log('here is the cached result');
      return result;
    }
  })<commit_msg>notes for production and test environments, for the future!<commit_after>const Redis = require('ioredis');
const redis = new Redis({
  port: 6379,          // Redis port
  host: '127.0.0.1',   // Redis host, may have to revisit for test and production environment
  db: 0
});
redis.config('set', 'maxmemory-policy', 'allkeys-lru');

const setRedisIso = (url, data) => {
  let value = JSON.stringify(data);
  redis.set(url, value)
  .catch(error=>error);
};

const getRedisIso = (url) => {
  return redis.get(url)
  .then(result => {
    console.log('result', result);
    if (result === null) {
      console.log('this place is not in the db, fall to navitia');
      return result;
    } else {
      console.log('here is the cached result');
      return result;
    }
  })
{'fraction_non_alphanumeric': 0.15964063579820317, 'fraction_numerical': 0.01520387007601935, 'mean_word_length': 3.0446927374301676, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4703986', 'n_tokens_mistral': 508, 'n_tokens_neox': 496, 'n_words': 139}