{"size": 488, "ext": "js", "max_stars_repo_path": "lib/db_classes/MemoryDB.js", "max_stars_repo_name": "YJDoc2/Kerberos-JS-Module", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "lib/db_classes/MemoryDB.js", "max_issues_repo_name": "YJDoc2/Kerberos-JS-Module", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "lib/db_classes/MemoryDB.js", "max_forks_repo_name": "YJDoc2/Kerberos-JS-Module", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 19.52, "max_line_length": 59, "alphanum_fraction": 0.6454918033}
import DB from './DB';
import ServerError from '../ServerError';

/**
 * A DB that saves data in memory using map.
 * Exists only till program is running.
 * Usually would be faster than LocalDB.
 * Default choice for saving random numbers used by a user.
 */
export default class MemoryDB extends DB {
  data = null;
  constructor() {
    super();
    this.data = new Map();
  }

  save(name, obj) {
    this.data.set(name, obj);
  }

  get(name) {
    return this.data.get(name);
  }
}
