Poco::OSP

class CodeCache

Library: OSP
Package: Util
Header: Poco/OSP/CodeCache.h

Description

CodeCache is a utility class that manages the code cache directory where the shared libraries of resolved bundles are kept.

Member Summary

Member Functions: clear, hasLibrary, installLibrary, libraryTimestamp, pathFor, uninstallLibrary

Constructors

CodeCache

CodeCache(
    const std::string & path
);

Creates the CodeCache, using the given path.

If the cache directory does not exist, it is created.

Destructor

~CodeCache

~CodeCache();

Destroys the CodeCache.

Member Functions

clear

void clear();

Clears the cache by removing the entire cache directory.

hasLibrary

bool hasLibrary(
    const std::string & name
);

Returns true if a library with the given name is stored in the code cache.

The name must not contain an filename extension.

installLibrary

void installLibrary(
    const std::string & name,
    std::istream & istr
);

Installs the library with the given name, which must not contain an extension, into the code cache.

libraryTimestamp

Poco::Timestamp libraryTimestamp(
    const std::string & name
);

Returns library last modification timestamp.

The name must not contain an filename extension.

pathFor

std::string pathFor(
    const std::string & name,
    bool appendSuffix = true
);

Returns the full path for the library with the given name. If appendSuffix is true (default), appends the appropriate suffix for debug version and OS dynamic library extension.

uninstallLibrary

void uninstallLibrary(
    const std::string & name
);

Removes the library with the given name from the cache directory.