MCPcopy Index your code
hub / github.com/diffgram/diffgram / instance_list_cache_update

Method instance_list_cache_update

shared/annotation.py:627–661  ·  view source on GitHub ↗

High level idea of caching While going through this process, we know which instances are new and have the data in memory. We want to cache that data on the file so other processes like the video buffer can access it. Details: Specific

(self)

Source from the content-addressed store, hash-verified

625
626 # Tested
627 def instance_list_cache_update(self):
628 """
629 High level idea of caching
630 While going through this process, we know which instances are new
631 and have the data in memory. We want to cache that data on the file
632 so other processes like the video buffer can access it.
633
634 Details:
635 Specifically we assume that update_cache_single_instance_in_list_context() is called
636 and serializes a single new instance.
637
638 We assume if the instance existed that the instance serialized is the
639 existing one (ie so it has ids etc)
640 and if it's new, that we are doing this after flush so we have ids.
641
642 Acceptable states for cache:
643 a) Exactly Correct
644 b) Empty / None
645 None is from integrity perspective because it will rebuild from System of Record (Database)
646 BUT we do need to ensure if it exists its correct because
647 it gets "fed back" into the system from the user. (For video.)
648 """
649 if not self.file:
650 return
651 self.file.set_cache_by_key(
652 cache_key = 'instance_list',
653 value = self.instance_list_kept_serialized
654 )
655
656 FileStats.update_file_stats_data(
657 session = self.session,
658 instance_list = self.instance_list_kept_serialized,
659 file_id = self.file.id,
660 project = self.project
661 )
662
663 # Tested
664 def return_orginal_file_type(self):

Calls 2

set_cache_by_keyMethod · 0.80