If these two items are somehow related, you could just create a class to group them together with a unique id. You might have to edit some of this code (I haven't compiled this), but you can get a basic idea of how you can relate the two collections with a unique id(the key) and use that key for a cache. This would be more efficient than looping through the lists and concatenating it into a large string.
Strings are immutable. Meaning they can't be changed once they are created. So every time you're concatenating, you are in fact creating a new string. Which might slow down performance if you have a lot of values.
public class MyValue
{
public guid key {get;set;}
public List<ModelOne> models {get;set;}
public List<Guid> guids {get;set;}
public void MyValue(List<ModelOne> modelsIn, List<Guid> guidsIn)
{
key = Guid.NewGuid();
models = modelsIn;
guids = guidsIn;
}
}
public Dictionary<Guid,MyValue> Cache = new Dictionary<Guid,MyValue>();
public List<ModelTwo> SomeMethod(MyValue valueIn)
{
MyValue val;
If(Cache.TryGetValue(valueIn.Key, value)
return Cache[valueIn.Key].models;
else
{
Do Stuf...
put in cache...
return value;
}
}