Skip to content

allow for caching subsets of data #53

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
gidden opened this issue Jun 25, 2018 · 1 comment
Closed

allow for caching subsets of data #53

gidden opened this issue Jun 25, 2018 · 1 comment
Labels
enh New features & functionality

Comments

@gidden
Copy link
Member

gidden commented Jun 25, 2018

For reporting subsets of data (e.g., only one region), we will not want to pull all data into memory. However, the caching system currently only supports that. Key lines are:

    def element(self, ix_type, name, filters=None, cache=None):
        """internal function to retrieve a dataframe of item elements"""
        item = self.item(ix_type, name)

        # if dataframe in python cache, retrieve from there                                                                                                                       
        if name in self._pycache:
            return filtered(self._pycache[(ix_type, name)], filters)

        # if no cache, retrieve from Java with filters                                                                                                                            
        if filters is not None and not self._cache:
            return _get_ele_list(item, filters, **self._java_kwargs[ix_type])

        # otherwise, retrieve from Java and keep in python cache                                                                                                                  
        df = _get_ele_list(item, None, **self._java_kwargs[ix_type])

        # save if using memcache                                                                                                                                                  
        if self._cache:
            self._pycache[(ix_type, name)] = df

        return filtered(df, filters)

Here we would need to update how it works if cache is True and filters exist. Probably very low priority.

@gidden gidden added the enh New features & functionality label Jun 25, 2018
@khaeru
Copy link
Member

khaeru commented Jan 10, 2020

CachingBackend, added by #213, can cache a subset of all data in an item. See also #222 for follow-up discussion.

@khaeru khaeru closed this as completed Jan 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enh New features & functionality
Projects
None yet
Development

No branches or pull requests

2 participants