solidworks_mcp.cache¶
solidworks_mcp.cache ¶
Caching utilities for SolidWorks MCP runtime services.
Attributes¶
Classes¶
CachePolicy
dataclass
¶
Cache policy options for adapter responses.
Attributes:
| Name | Type | Description |
|---|---|---|
default_ttl_seconds |
int
|
The default ttl seconds value. |
enabled |
bool
|
The enabled value. |
max_entries |
int
|
The max entries value. |
ResponseCache ¶
Thread-safe in-memory cache for adapter response objects.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
policy
|
CachePolicy
|
The policy value. |
required |
Attributes:
| Name | Type | Description |
|---|---|---|
_lock |
Any
|
The lock value. |
_policy |
Any
|
The policy value. |
Initialize this cache.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
policy
|
CachePolicy
|
The policy value. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
None |
None
|
None. |
Source code in src/solidworks_mcp/cache/response_cache.py
Attributes¶
enabled
property
¶
Return whether caching is enabled.
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True if enabled, otherwise False. |
Functions¶
get ¶
Fetch a cached value when present and unexpired.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
key
|
str
|
The key value. |
required |
Returns:
| Type | Description |
|---|---|
object | None
|
object | None: The result produced by the operation. |
Source code in src/solidworks_mcp/cache/response_cache.py
make_key ¶
Build a deterministic cache key from an operation payload.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
operation
|
str
|
Callable object executed by the helper. |
required |
payload
|
object
|
The payload value. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
The resulting text value. |
Source code in src/solidworks_mcp/cache/response_cache.py
set ¶
Store a cache value with expiration.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
key
|
str
|
The key value. |
required |
value
|
object
|
The value value. |
required |
ttl_seconds
|
int | None
|
The ttl seconds value. Defaults to None. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
None |
None
|
None. |