Foundry.PathCache

g Foundry.PathCache Foundry.PathCache GObject.Object GObject.Object GObject.Object->Foundry.PathCache

Subclasses:

None

Methods

Inherited:

GObject.Object (37)

Structs:

GObject.ObjectClass (5)

class

new ()

contains (program_name)

insert (program_name, program_path)

lookup (program_name)

Virtual Methods

Inherited:

GObject.Object (7)

Properties

None

Signals

Inherited:

GObject.Object (1)

Fields

Inherited:

GObject.Object (1)

Class Details

class Foundry.PathCache(**kwargs)
Bases:

GObject.Object

Abstract:

No

Structure:

Foundry.PathCacheClass

Thread-safe cache for path lookups

Foundry.PathCache can be used to cache path lookup entries as often needed by runtimes.

This object is thread-safe and may be accessed from multiple threads simultaneously.

classmethod new()
Return type:

Foundry.PathCache

contains(program_name)
Parameters:

program_name (str) – the name of the program to lookup

Returns:

True if an entry was found and had_program_path is set; otherwise False.

had_program_path:

a location to store if a path was found for program_name.

Return type:

(bool, had_program_path: bool)

This function helps for detecting negative cache entries without copying the program_path string.

insert(program_name, program_path)
Parameters:
  • program_name (str) – the name of the program

  • program_path (str or None) – the path for the program

Inserts a cache entry for program_name for program_path.

program_path may be None to register a negative cache entry. See Foundry.PathCache.lookup() for handling negative cache entries.

lookup(program_name)
Parameters:

program_name (str) – the program name to lookup

Returns:

True if program_name was found and program_path is set; otherwise False is returned.

program_path:

a location to store the program_path for program_name.

Return type:

(bool, program_path: str or None)

True is returned when an entry is found in the cache. That entry may be None indicating a negative cache entry.