Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:103006 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 96651 invoked from network); 1 Aug 2018 09:29:26 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 1 Aug 2018 09:29:26 -0000 Authentication-Results: pb1.pair.com header.from=joshdifabio@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=joshdifabio@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.216.181 as permitted sender) X-PHP-List-Original-Sender: joshdifabio@gmail.com X-Host-Fingerprint: 209.85.216.181 mail-qt0-f181.google.com Received: from [209.85.216.181] ([209.85.216.181:45434] helo=mail-qt0-f181.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id D6/EB-14835-47D716B5 for ; Wed, 01 Aug 2018 05:29:25 -0400 Received: by mail-qt0-f181.google.com with SMTP id y5-v6so19085451qti.12 for ; Wed, 01 Aug 2018 02:29:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=Pn0WbP+EYcwDeFmuv5+rmdT9U+8zBle8o3liZLBNUFg=; b=ElhE11bDCxacJe7Cty1lKLgiDugFFvxMC0EOo5q2u/ZwYRUx1HXHkiyh4iuog8WSc6 8c/4wYWd1GguKhk5WygltX+Mf/r0eFoMRVw/peKcTJFkAnQxFW74J0T+nTdjO3bVITNj fzCXnoscIYpNeE8BKCvcvRwf6p3USdpLqcFkFBFv145DKrW5VgGnbKyfFXIA/E5qo6gl /ZxZQ1xXF7h4RaL20cekxBkV01gqFUdju3Fc2kru9dT0Tfbh8q8U4wVVWy3HofvWh5p7 i1jxgKUPyZaQq9nchRoZ5UYzzVNYoN/nJFE9DKvtlRBN6zZtmOLZs3SxzEvv8fmPemMI gPgA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=Pn0WbP+EYcwDeFmuv5+rmdT9U+8zBle8o3liZLBNUFg=; b=kqaTP6dZe2d2WbnTtdAyueVu4ktWzsvD/dUoT5O02OWqxQJgcY4H2HocGawj4cYEhr 2BEns+qjmml8sDAtk0ntI6ic0Zj1lzEuDiSPn/kFP0frHPUENM5w+u2Q+yQTq9Ea9dMJ Ye/i0yycadXiZ52B9/P1OXd4EO+EQ5gozk4IklngOMXqJT1ZciYtY+ugTae6cq0lLupK ieHsKmOKm1c8RykHLwaXxQBjpoydud0d5FcNKtwjG683q9gYyinSd4B2GFUg0134q97s Us+yz/OuxsxSBakO9t72uAgaXvEEWft5AeoBt+hHqNClzwnHZDf/jmRzr6UQwx+9OVx5 dQRQ== X-Gm-Message-State: AOUpUlHmhT9rPkBD/Yqx63bk+So9dAAFmphBGNxSvo+Qc+N8qYFqLC2/ E8xBEBXwtLJzH+q66aiOpgro5lASZOTu5d7S/PAFkqe/ X-Google-Smtp-Source: AAOMgpe177xUffGDac6uLkEcTlsua+HdxFehnpoky/u0HgjnKXBxPqQASIkFhdmpLqRfUhAc2G1P55KuDYlvP9+UshY= X-Received: by 2002:ac8:2ad8:: with SMTP id c24-v6mr24686694qta.117.1533115761199; Wed, 01 Aug 2018 02:29:21 -0700 (PDT) MIME-Version: 1.0 Date: Wed, 1 Aug 2018 10:29:10 +0100 Message-ID: To: PHP internals Content-Type: text/plain; charset="UTF-8" Subject: Internal LRU cache implementation From: joshdifabio@gmail.com (Josh Di Fabio) Hello internals, In my experience, LRU cache is a common pattern in userland. Each time I write one in PHP, I suspect that it would probably be much more efficient if it was implemented in C. If this is indeed a very common pattern, and it would be much more efficient implemented internally, is there any appetite for an internal implementation of LRU cache? I would suggest the following interface as a starting point: __construct(int size) resize(int n) get(scalar key) set(scalar key, value) remove(scalar key) Thanks for your time