static bool TryGetCached( string identString, Sandbox.Package& package, bool allowPartial )

robot_2Generated
code_blocksInput

Description

The TryGetCached method attempts to retrieve a cached package based on the provided identifier string. It is a static method of the Package class in the Sandbox namespace. This method is useful for checking if a package is already available in the cache without needing to fetch it from a remote source.

Usage

To use the TryGetCached method, provide the identifier string of the package you are looking for, a reference to a Package object to store the result, and a boolean indicating whether partial matches are allowed. The method returns true if the package is found in the cache, otherwise it returns false.

Parameters:

  • identString (System.String): The identifier string of the package to search for in the cache.
  • package (out Sandbox.Package): An output parameter that will hold the cached package if found.
  • allowPartial (System.Boolean): A boolean indicating whether partial matches are acceptable.

Example

// Example usage of TryGetCached method
string packageIdentifier = "example.package.id";
Package cachedPackage;
bool allowPartialMatch = false;

bool isCached = Package.TryGetCached(packageIdentifier, out cachedPackage, allowPartialMatch);

if (isCached)
{
    // Package was found in cache
    // You can now use cachedPackage
}
else
{
    // Package was not found in cache
    // Consider fetching it from a remote source
}