Class CachedSpaceStorage

java.lang.Object
org.exoplatform.social.core.jpa.storage.SpaceStorage
org.exoplatform.social.core.storage.cache.CachedSpaceStorage

public class CachedSpaceStorage extends SpaceStorage
  • Constructor Details

    • CachedSpaceStorage

      public CachedSpaceStorage(SpaceDAO spaceDAO, SpaceMemberDAO spaceMemberDAO, org.exoplatform.social.core.storage.api.IdentityStorage identityStorage, IdentityDAO identityDAO, ActivityDAO activityDAO, SpaceExternalInvitationDAO spaceExternalInvitationDAO, SocialStorageCacheService cacheService, org.exoplatform.social.metadata.favorite.FavoriteService favoriteService, org.exoplatform.web.security.security.RemindPasswordTokenService remindPasswordTokenService)
  • Method Details

    • getCachedIdentityStorage

      public CachedIdentityStorage getCachedIdentityStorage()
      Get cached identity storage.
      Returns:
      Since:
      1.2.8
    • saveSpace

      public org.exoplatform.social.core.space.model.Space saveSpace(org.exoplatform.social.core.space.model.Space space, boolean isNew)
      Overrides:
      saveSpace in class SpaceStorage
    • saveSpace

      public org.exoplatform.social.core.space.model.Space saveSpace(org.exoplatform.social.core.space.model.Space space, Long parentSpaceId, boolean isNew)
      Overrides:
      saveSpace in class SpaceStorage
    • renameSpace

      public void renameSpace(org.exoplatform.social.core.space.model.Space space) throws org.exoplatform.social.core.storage.SpaceStorageException
      Overrides:
      renameSpace in class SpaceStorage
      Throws:
      org.exoplatform.social.core.storage.SpaceStorageException
    • deleteSpace

      public void deleteSpace(String id) throws org.exoplatform.social.core.storage.SpaceStorageException
      Overrides:
      deleteSpace in class SpaceStorage
      Throws:
      org.exoplatform.social.core.storage.SpaceStorageException
    • ignoreSpace

      public void ignoreSpace(String spaceId, String userId)
      Overrides:
      ignoreSpace in class SpaceStorage
    • getManagerSpacesByFilter

      public List<org.exoplatform.social.core.space.model.Space> getManagerSpacesByFilter(String userId, org.exoplatform.social.core.space.SpaceFilter spaceFilter, long offset, long limit)
      Overrides:
      getManagerSpacesByFilter in class SpaceStorage
    • getManagerSpacesByFilterCount

      public int getManagerSpacesByFilterCount(String userId, org.exoplatform.social.core.space.SpaceFilter spaceFilter)
      Overrides:
      getManagerSpacesByFilterCount in class SpaceStorage
    • getMemberSpacesByFilterCount

      public int getMemberSpacesByFilterCount(String userId, org.exoplatform.social.core.space.SpaceFilter spaceFilter)
      Overrides:
      getMemberSpacesByFilterCount in class SpaceStorage
    • getMemberSpacesByFilter

      public List<org.exoplatform.social.core.space.model.Space> getMemberSpacesByFilter(String userId, org.exoplatform.social.core.space.SpaceFilter spaceFilter, long offset, long limit)
      Overrides:
      getMemberSpacesByFilter in class SpaceStorage
    • getUserSpaces

      public List<org.exoplatform.social.core.space.model.Space> getUserSpaces(String viewerUsername, String profileOwnerUsername, io.meeds.social.space.constant.UserSpacesScope scope, org.exoplatform.social.core.search.Sorting sorting, long offset, long limit)
      Lists the spaces where a profile owner has the member role, restricted to what a viewer is allowed to see. The access decision itself belongs to the Service layer: this method only translates an already decided scope into a datastore filter.

      Only the first page is cached. This listing is the first family of spacesCache keyed on a pair of users (owner x viewer x scope), where every other family is keyed on a single one, and the cache is shared: the region is registered outside this repository, in Meeds-io/meeds -> webapps/plf-meeds-extension/src/main/webapp/WEB-INF/conf/meeds/cache-configuration.xml, as ${meeds.cache.social.SpacesCache.MaxNodes:4000} entries for every space listing of the instance, with no implementation or strategy set, so eviction is FIFO: the oldest entry goes first, however hot it is. Caching the drawer's subsequent pages as well would let profile browsing evict the listings this cache exists for — the home spaces widget, the space directory. Bounding the new family to the page that renders on every profile view is the fallback the specification states for this cardinality (eXIP 7.3.0.18, note 50524 §4).

      The bypass removes the offset dimension, not the limit one: ListSpacesKey compares both, so a caller varying limit still multiplies entries. The widget and the drawer each pass a fixed page size, and the REST endpoint bounds limit to UserSpacesRest.MAX_LIMIT.

      Overrides:
      getUserSpaces in class SpaceStorage
      Parameters:
      viewerUsername - remote id of the viewer, mandatory. When it is the profile owner themselves, both scopes list every space they are a member of, hidden ones included — the viewer is a member of all of them by definition
      profileOwnerUsername - remote id of the profile owner
      scope - effective UserSpacesScope, as decided by the Service
      sorting - the Sorting to apply
      offset - The starting point
      limit - The maximum number of returned results
      Returns:
      List of Space
    • countUserSpaces

      public int countUserSpaces(String viewerUsername, String profileOwnerUsername, io.meeds.social.space.constant.UserSpacesScope scope)
      Counts the spaces returned by SpaceStorage.getUserSpaces(String, String, UserSpacesScope, Sorting, long, long).

      Cached for every page, unlike the listing above: the count carries neither an offset nor a limit dimension, so it adds at most one entry per (owner, viewer, scope) — and in social.SpacesCountCache, a budget of its own, separate from the listing cache. It is offered to REST callers through the returnSize parameter; no product screen issues it today — the widget displays no total and the "See all" drawer paginates with an extra row instead (eXIP 7.3.0.18, note 50524 §2 query budget). Recomputing it means a full COUNT(DISTINCT s.id) over the membership scan, reasoned to be the more expensive of the two — not measured here, the unit suite proves the statement executes, not what it costs.

      Overrides:
      countUserSpaces in class SpaceStorage
      Parameters:
      viewerUsername - remote id of the viewer, mandatory
      profileOwnerUsername - remote id of the profile owner
      scope - effective UserSpacesScope, as decided by the Service
      Returns:
      the number of spaces
    • getPendingSpacesByFilterCount

      public int getPendingSpacesByFilterCount(String userId, org.exoplatform.social.core.space.SpaceFilter spaceFilter)
      Overrides:
      getPendingSpacesByFilterCount in class SpaceStorage
    • getPendingSpacesByFilter

      public List<org.exoplatform.social.core.space.model.Space> getPendingSpacesByFilter(String userId, org.exoplatform.social.core.space.SpaceFilter spaceFilter, long offset, long limit)
      Overrides:
      getPendingSpacesByFilter in class SpaceStorage
    • getInvitedSpacesByFilterCount

      public int getInvitedSpacesByFilterCount(String userId, org.exoplatform.social.core.space.SpaceFilter spaceFilter)
      Overrides:
      getInvitedSpacesByFilterCount in class SpaceStorage
    • getInvitedSpacesByFilter

      public List<org.exoplatform.social.core.space.model.Space> getInvitedSpacesByFilter(String userId, org.exoplatform.social.core.space.SpaceFilter spaceFilter, long offset, long limit)
      Overrides:
      getInvitedSpacesByFilter in class SpaceStorage
    • getAccessibleSpacesByFilterCount

      public int getAccessibleSpacesByFilterCount(String userId, org.exoplatform.social.core.space.SpaceFilter spaceFilter)
      Overrides:
      getAccessibleSpacesByFilterCount in class SpaceStorage
    • getVisibleSpacesCount

      public int getVisibleSpacesCount(String userId, org.exoplatform.social.core.space.SpaceFilter spaceFilter) throws org.exoplatform.social.core.storage.SpaceStorageException
      Overrides:
      getVisibleSpacesCount in class SpaceStorage
      Throws:
      org.exoplatform.social.core.storage.SpaceStorageException
    • getAccessibleSpacesByFilter

      public List<org.exoplatform.social.core.space.model.Space> getAccessibleSpacesByFilter(String userId, org.exoplatform.social.core.space.SpaceFilter spaceFilter, long offset, long limit)
      Overrides:
      getAccessibleSpacesByFilter in class SpaceStorage
    • getAllSpacesByFilterCount

      public int getAllSpacesByFilterCount(org.exoplatform.social.core.space.SpaceFilter spaceFilter)
      Overrides:
      getAllSpacesByFilterCount in class SpaceStorage
    • getSpacesByFilter

      public List<org.exoplatform.social.core.space.model.Space> getSpacesByFilter(org.exoplatform.social.core.space.SpaceFilter spaceFilter, long offset, long limit)
      Overrides:
      getSpacesByFilter in class SpaceStorage
    • getSpaceById

      public org.exoplatform.social.core.space.model.Space getSpaceById(long id) throws org.exoplatform.social.core.storage.SpaceStorageException
      Overrides:
      getSpaceById in class SpaceStorage
      Throws:
      org.exoplatform.social.core.storage.SpaceStorageException
    • getSpaceByPrettyName

      public org.exoplatform.social.core.space.model.Space getSpaceByPrettyName(String spacePrettyName) throws org.exoplatform.social.core.storage.SpaceStorageException
      Overrides:
      getSpaceByPrettyName in class SpaceStorage
      Throws:
      org.exoplatform.social.core.storage.SpaceStorageException
    • getSpaceByGroupId

      public org.exoplatform.social.core.space.model.Space getSpaceByGroupId(String groupId) throws org.exoplatform.social.core.storage.SpaceStorageException
      Overrides:
      getSpaceByGroupId in class SpaceStorage
      Throws:
      org.exoplatform.social.core.storage.SpaceStorageException
    • updateSpaceAccessed

      public void updateSpaceAccessed(String remoteId, org.exoplatform.social.core.space.model.Space space) throws org.exoplatform.social.core.storage.SpaceStorageException
      Overrides:
      updateSpaceAccessed in class SpaceStorage
      Throws:
      org.exoplatform.social.core.storage.SpaceStorageException
    • getLastAccessedSpace

      public List<org.exoplatform.social.core.space.model.Space> getLastAccessedSpace(org.exoplatform.social.core.space.SpaceFilter filter, int offset, int limit) throws org.exoplatform.social.core.storage.SpaceStorageException
      Overrides:
      getLastAccessedSpace in class SpaceStorage
      Throws:
      org.exoplatform.social.core.storage.SpaceStorageException
    • getLastSpaces

      public List<org.exoplatform.social.core.space.model.Space> getLastSpaces(int limit)
      Overrides:
      getLastSpaces in class SpaceStorage
    • getMemberRoleSpaceIdentityIds

      public List<String> getMemberRoleSpaceIdentityIds(String identityId, int offset, int limit) throws org.exoplatform.social.core.storage.SpaceStorageException
      Overrides:
      getMemberRoleSpaceIdentityIds in class SpaceStorage
      Throws:
      org.exoplatform.social.core.storage.SpaceStorageException
    • getMemberRoleSpaceIds

      public List<String> getMemberRoleSpaceIds(String identityId, int offset, int limit) throws org.exoplatform.social.core.storage.SpaceStorageException
      Overrides:
      getMemberRoleSpaceIds in class SpaceStorage
      Throws:
      org.exoplatform.social.core.storage.SpaceStorageException
    • countSpacesByTemplate

      public Map<Long,Long> countSpacesByTemplate()
      Overrides:
      countSpacesByTemplate in class SpaceStorage
    • clearSpaceCached

      public void clearSpaceCached(String spaceId)
    • clearCaches

      public void clearCaches()