Sha256: 82b9b280b407f42cc2b2ae55612c8be0d1234131511829f303def01e2fad7567
Contents?: true
Size: 848 Bytes
Versions: 18
Compression:
Stored size: 848 Bytes
Contents
# Copyright (c) 2023 Contrast Security, Inc. See https://www.contrastsecurity.com/enduser-terms-0317a for more details. # frozen_string_literal: true module Contrast module Utils module Assess # keep track of object properties and events data class ObjectStore def initialize capacity = 500 @capacity = capacity @cache = {} end def get @cache end def [] key @cache[key] end def delete key @cache.delete(key) end # We would keep object ids with capacity. # If a reference is kept to an object only by it's id, # It would be CG-ted safely. def []= key, value @cache[key] = value @cache.shift if @cache.length > @capacity end end end end end
Version data entries
18 entries across 18 versions & 1 rubygems