polydata-client 0.1.0__tar.gz → 0.1.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,6 +5,15 @@ All notable changes to the Polydata Python client will be documented in this fil
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [0.1.1] - 2026-01-27
9
+
10
+ ### Added
11
+
12
+ - Added utilities to manage and update the cache
13
+ - `client.get_cache_stats()` Gets the Redis cache statistics.
14
+ - `client.clear_hub_cache()` Clears all cached data app pages for a Hub.
15
+
16
+
8
17
  ## [0.1.0] - 2026-01-16
9
18
 
10
19
  ### Added
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: polydata-client
3
- Version: 0.1.0
3
+ Version: 0.1.1
4
4
  Summary: Official Python client for Polydata API
5
5
  Author-email: Polydata <support@polydata.co>
6
6
  Maintainer-email: Polydata <support@polydata.co>
@@ -664,3 +664,59 @@ class PolydataClient:
664
664
  df = pd.DataFrame(endpoints_list)
665
665
  print(f"✓ Retrieved {len(df)} endpoints for hub: {hub_schema}")
666
666
  return df
667
+
668
+ def get_cache_stats(self) -> dict:
669
+ """
670
+ Get Redis cache statistics.
671
+
672
+ Returns:
673
+ Dict: Cache statistics including total keys and memory usage
674
+
675
+ Raises:
676
+ Exception: If retrieval fails
677
+ """
678
+ response = self.session.get(f"{self.base_url}/cache/stats")
679
+ response_data = self._handle_response(
680
+ response, error_context="Get cache stats"
681
+ )
682
+ stats = response_data.get("data", {})
683
+ total_keys = stats.get("total_keys", 0)
684
+ print(f"✓ Cache stats retrieved: {total_keys} total keys")
685
+ return response_data
686
+
687
+ def clear_hub_cache(
688
+ self, hub_schema_name: str, entity_type: str = "data_app_page"
689
+ ) -> bool:
690
+ """
691
+ Clear all cached pages for a hub.
692
+
693
+ This is useful after uploading new data to ensure users see fresh data
694
+ without having to rebuild the entire app.
695
+
696
+ Args:
697
+ hub_schema_name: The hub schema name (e.g., "football_player_ratings")
698
+
699
+ Returns:
700
+ bool: True if successful, False otherwise
701
+
702
+ Raises:
703
+ Exception: If cache clear fails
704
+ """
705
+ response = self.session.delete(
706
+ f"{self.base_url}/cache/{hub_schema_name}/{entity_type}"
707
+ )
708
+ response_data = self._handle_response(
709
+ response,
710
+ success_message=f"✓ Cleared cache for hub: {hub_schema_name}",
711
+ error_context=f"Clear cache for hub {hub_schema_name}",
712
+ )
713
+
714
+ data = response_data.get("data", {})
715
+ deleted = data.get("deleted_count", 0)
716
+ total = data.get("total_pages_in_hub", 0)
717
+ cached = data.get("cached_pages", 0)
718
+ print(
719
+ f" - Cleared {deleted} cached pages out of {cached} that were cached ({total} total pages)"
720
+ )
721
+
722
+ return True
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: polydata-client
3
- Version: 0.1.0
3
+ Version: 0.1.1
4
4
  Summary: Official Python client for Polydata API
5
5
  Author-email: Polydata <support@polydata.co>
6
6
  Maintainer-email: Polydata <support@polydata.co>
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "polydata-client"
3
- version = "0.1.0"
3
+ version = "0.1.1"
4
4
  description = "Official Python client for Polydata API"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.8"
File without changes
File without changes