403Webshell
Server IP : 93.86.61.54  /  Your IP : 216.73.216.206
Web Server : Apache/2.4.62 (Ubuntu)
System : Linux rasin.ddns.net 6.8.0-124-generic #124~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Tue May 26 21:05:19 UTC x86_64
User : www-data ( 33)
PHP Version : 8.4.22
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /usr/lib/python3/dist-packages/fs/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/lib/python3/dist-packages/fs/lrucache.py
"""Least Recently Used cache mapping.
"""

from __future__ import absolute_import
from __future__ import unicode_literals

import typing
from collections import OrderedDict


_K = typing.TypeVar("_K")
_V = typing.TypeVar("_V")


class LRUCache(OrderedDict, typing.Generic[_K, _V]):
    """A dictionary-like container that stores a given maximum items.

    If an additional item is added when the LRUCache is full, the least
    recently used key is discarded to make room for the new item.

    """

    def __init__(self, cache_size):
        # type: (int) -> None
        self.cache_size = cache_size
        super(LRUCache, self).__init__()

    def __setitem__(self, key, value):
        # type: (_K, _V) -> None
        """Store a new views, potentially discarding an old value.
        """
        if key not in self:
            if len(self) >= self.cache_size:
                self.popitem(last=False)
        OrderedDict.__setitem__(self, key, value)

    def __getitem__(self, key):
        # type: (_K) -> _V
        """Get the item, but also makes it most recent.
        """
        _super = typing.cast(OrderedDict, super(LRUCache, self))
        value = _super.__getitem__(key)
        _super.__delitem__(key)
        _super.__setitem__(key, value)
        return value

Youez - 2016 - github.com/yon3zu
LinuXploit