Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cacheable-lookup

Package Overview
Dependencies
Maintainers
2
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cacheable-lookup - npm Package Compare versions

Comparing version 4.1.0 to 4.1.1

source/hosts-resolver.js

2

package.json
{
"name": "cacheable-lookup",
"version": "4.1.0",
"version": "4.1.1",
"description": "A cacheable dns.lookup(…) that respects the TTL",

@@ -5,0 +5,0 @@ "engines": {

@@ -191,11 +191,14 @@ # cacheable-lookup

See the benchmarks (queries `localhost`, performed on i7-7700k):
Performed on:
- Query: `example.com`
- CPU: i7-7700k
- CPU governor: performance
```
CacheableLookup#lookupAsync x 4,095,922 ops/sec ±1.01% (84 runs sampled)
CacheableLookup#lookupAsync.all x 4,472,817 ops/sec ±0.67% (88 runs sampled)
CacheableLookup#lookupAsync.all.ADDRCONFIG x 3,713,702 ops/sec ±0.66% (85 runs sampled)
CacheableLookup#lookup x 3,332,170 ops/sec ±0.50% (82 runs sampled)
CacheableLookup#lookup.all x 3,303,159 ops/sec ±0.61% (84 runs sampled)
CacheableLookup#lookup.all.ADDRCONFIG x 2,851,815 ops/sec ±0.82% (84 runs sampled)
CacheableLookup#lookupAsync x 2,024,888 ops/sec ±0.84% (87 runs sampled)
CacheableLookup#lookupAsync.all x 2,093,860 ops/sec ±1.00% (88 runs sampled)
CacheableLookup#lookupAsync.all.ADDRCONFIG x 1,898,088 ops/sec ±0.61% (89 runs sampled)
CacheableLookup#lookup x 1,905,060 ops/sec ±0.76% (90 runs sampled)
CacheableLookup#lookup.all x 1,889,284 ops/sec ±1.37% (87 runs sampled)
CacheableLookup#lookup.all.ADDRCONFIG x 1,740,616 ops/sec ±0.83% (89 runs sampled)
CacheableLookup#lookupAsync - zero TTL x 226 ops/sec ±3.55% (56 runs sampled)

@@ -202,0 +205,0 @@ CacheableLookup#lookup - zero TTL x 228 ops/sec ±2.48% (62 runs sampled)

@@ -5,3 +5,3 @@ 'use strict';

const os = require('os');
const createHostsResolver = require('./create-hosts-resolver');
const HostsResolver = require('./hosts-resolver');

@@ -115,7 +115,5 @@ const {Resolver: AsyncResolver} = dnsPromises;

this._iface = getIfaceInfo();
this._hostsResolver = new HostsResolver(customHostsPath);
this._tickLocked = false;
this._hostsResolver = createHostsResolver(customHostsPath);
this.tick();
this.lookup = this.lookup.bind(this);

@@ -191,3 +189,3 @@ this.lookupAsync = this.lookupAsync.bind(this);

async query(hostname) {
let cached = this._hostsResolver.hosts[hostname] || await this._cache.get(hostname);
let cached = await this._hostsResolver.get(hostname) || await this._cache.get(hostname);

@@ -259,3 +257,3 @@ if (!cached || cached.length === 0) {

this._hostsResolver.updateHosts();
this._hostsResolver.update();

@@ -308,2 +306,3 @@ this._tickLocked = true;

this._iface = getIfaceInfo();
this._hostsResolver.update();
this._cache.clear();

@@ -310,0 +309,0 @@ }

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc