public Optional<VersionedProfile> get(UUID uuid, String version) {
    Optional<VersionedProfile> profile = redisGet(uuid, version);

    if (profile.isEmpty()) {
      profile = profiles.get(uuid, version);
      profile.ifPresent(versionedProfile -> redisSet(uuid, versionedProfile));
    }

    return profile;
  }
@Test
  public void testGetProfileInCache() throws InvalidInputException {
    final UUID uuid = UUID.randomUUID();
    final byte[] name = TestRandomUtil.nextBytes(81);
    final byte[] commitment = new ProfileKey(new byte[32]).getCommitment(new ServiceId.Aci(uuid)).serialize();
    when(commands.hget(eq("profiles::" + uuid), eq("someversion"))).thenReturn(String.format(
        "{\"version\": \"someversion\", \"name\": \"%s\", \"avatar\": \"someavatar\", \"commitment\":\"%s\"}",
        ProfileTestHelper.encodeToBase64(name),
        ProfileTestHelper.encodeToBase64(commitment)));

    Optional<VersionedProfile> profile = profilesManager.get(uuid, "someversion");

    assertTrue(profile.isPresent());
    assertArrayEquals(profile.get().name(), name);
    assertEquals(profile.get().avatar(), "someavatar");
    assertArrayEquals(profile.get().commitment(), commitment);

    verify(commands, times(1)).hget(eq("profiles::" + uuid), eq("someversion"));
    verifyNoMoreInteractions(commands);
    verifyNoMoreInteractions(profiles);
  }